我已经创建了 WPF MVVM 应用程序,并将 WPFToolkit DataGrid 绑定设置为 DataTable,所以我想知道如何实现 DataTable 属性以通知更改。目前我的代码如下所示。
public DataTable Test
{
get { return this.testTable; }
set
{
...
...
base.OnPropertyChanged("Test");
}
}
public void X()
{
this.Test.Add(...); // I suppose this line will call to getter first (this.Test = get Test) and then it will call add letter, this mean that setter scope will never fire.
base.OnPropertyChanged("Test"); // my solution is here :) but I hope it has better ways.
}
这个问题有其他解决方案吗?