我有一个看起来大致像这样的模型:
private bool IsProduct {get; set;}
private decimal ProductPrice {get; set;}
private decimal TimedRate {get; set;}
public decimal SingularAmount {
get {
if (this.IsProduct) {
return ProductPrice;
}
else {
return TimedRate;
}
}
set {
if (this.IsProduct) {
this.ProductPrice = value;
}
else {
this.TimedRate = value;
}
}
}
我通过 RIA 服务将这个 SingularAmount 属性绑定到 Silverlight 3 DataGrid。我发现,当我更改属性时 - 模型上的相应属性不会更新。当我单步执行代码时,我可以在客户端看到,例如 SingularAmount 设置为 5,其他属性没有得到更新。
似乎当 RIA 制作类的客户端版本时,这种功能并没有被移植。关于如何解决这个问题的任何想法?
更新
这是 RIA 为该属性生成的代码:
[DataMember()]
public decimal SingularAmount
{
get
{
return this._singularAmount;
}
set
{
if ((this._singularAmount != value))
{
this.ValidateProperty("SingularAmount", value);
this.OnSingularAmountChanging(value);
this.RaiseDataMemberChanging("SingularAmount");
this._singularAmount = value;
this.RaiseDataMemberChanged("SingularAmount");
this.OnSingularAmountChanged();
}
}
}
显然,这看起来不像原来的服务器端属性。