可能重複:
Why does the binding update without implementing INotifyPropertyChanged?Model屬性更改通知
我有WPF:
<TextBlock Grid.Row="0" Text="{Binding SomeProperty}" />
<TextBox Grid.Row="1" Text="{Binding SomeProperty, UpdateSourceTrigger=PropertyChanged}" />
綁定到
class MyModel1 { string _someProperty = string.Empty; public string SomeProperty { get { return _someProperty; } set { _someProperty = value; } } }
它allso作品有:
class MyModel { public string SomeProperty { get; set; } }
,你看有沒有屬性更改通知,但同時我打字到文本框的TextBlock被更新。 我使用Visual C#express 2010,標準的WPF應用程序項目模板,標準控件,沒有片段,沒有額外的,與.NET 4客戶端配置文件。
- 問題1:爲什麼它的工作原理?
- 問題2:.NET 4的新功能?
- 問題3:我如何能獲取有關屬性更改通知從 我的代碼無須在我的模型中的任何事件?
謝謝
是的,這是dublicate ... :) – Dule