我有我想要綁定到一個表格屬性「regimeAlias」的元素一個TextBox與tbRegimes
表中的列,我已經與實體框架映射:在我的ViewModelWPF:將TextBox文本綁定到WCF屬性的子元素?
<TextBox Text="{Binding NewRegime.regimeAlias, Mode=TwoWay}"/>
公開的屬性:
private tbRegime _NewRegime;
public tbRegime NewRegime
{
get { return _NewRegime; }
set
{
_NewRegime = value;
OnPropertyChanged("NewRegime");
}
}
最後,這裏的WCF服務參考自動生成的代碼類:
public partial class tbRegime : object, System.Runtime.Serialization.IExtensibleDataObject, System.ComponentModel.INotifyPropertyChanged {
//blah blah blah
[System.Runtime.Serialization.DataMemberAttribute()]
public string regimeAlias {
get {
return this.regimeAliasField;
}
set {
if ((object.ReferenceEquals(this.regimeAliasField, value) != true)) {
this.regimeAliasField = value;
this.RaisePropertyChanged("regimeAlias");
}
}
}
釷電子二傳手永遠不會被擊中。這是因爲NewRegime
對象中的每個元素都需要提升PropertyChanged
,如果有的話,是否有一個簡單的解決方法,而不需要向我的代碼添加更多的DTO圖層?
但是否爲regimeAlias的setter被打中? – Paparazzi 2014-11-06 14:08:07