FrameworkElement.DataContextChanged 事件
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
這個項目的資料內容變更時發生。
public:
event System::Windows::DependencyPropertyChangedEventHandler ^ DataContextChanged;
C#
public event System.Windows.DependencyPropertyChangedEventHandler DataContextChanged;
member this.DataContextChanged : System.Windows.DependencyPropertyChangedEventHandler
Public Custom Event DataContextChanged As DependencyPropertyChangedEventHandler
如需資料內容和資料系結的說明,請參閱 資料系結概觀。
重要
DataContext當 元素的 變更時,此元素上的所有資料系結屬性都可能會受到影響。 這適用于邏輯樹狀結構中目前專案之子專案的任何專案,這些元素會繼承資料內容,以及目前專案本身。 所有這類現有系結都必須重新解譯新的 DataContext ,並重新評估系結結果。 相對於引發 DataContextChanged 事件,資料系結引擎無法判斷這些重新評估的順序。 重新評估可以在事件、事件之後或任何混合中發生。
產品 | 版本 |
---|---|
.NET Framework | 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
Windows Desktop | 3.0, 3.1, 5, 6, 7, 8, 9, 10 |