dot*_*NET 2 c# wpf dependency-properties inotifypropertychanged
看起来WPF并不总是调用a的注册PropertyChangedCallback过程DependencyProperty.即使我们PropertyChanged从VM 手动提升事件,WPF似乎实际上在评估它是否会调用回调之前评估该属性的旧值和新值.所以我的问题是:
我的ViewModel有一个公共属性定义如下:
Public ReadOnly Property CurrentSelection() As ObservableCollection(Of Object)
Run Code Online (Sandbox Code Playgroud)
我的视图绑定到此属性(BetterPropertyGrid是一个UserControl,它包含WinForms PropertyGrid并且有一个DependencyProperty命名SelectedObjects):
<bd:BetterPropertyGrid SelectedObjects="{Binding CurrentSelection}" />
Run Code Online (Sandbox Code Playgroud)
现在每当我的ViewModel在CurrentSelection中添加或删除对象时,我都会手动提升PropertyChanged("CurrentSelection"),但它似乎没有更新我的View.
| 归档时间: |
|
| 查看次数: |
2846 次 |
| 最近记录: |