FrameworkContentElement.DataContextChanged 事件

定義

當這個項目的資料內容變更時發生。Occurs when this element's data context changes.

public:
 event System::Windows::DependencyPropertyChangedEventHandler ^ DataContextChanged;
public event System.Windows.DependencyPropertyChangedEventHandler DataContextChanged;
member this.DataContextChanged : System.Windows.DependencyPropertyChangedEventHandler 
Public Custom Event DataContextChanged As DependencyPropertyChangedEventHandler 

備註

如需資料內容和資料系結的說明,請參閱資料系結總覽For an explanation of data contexts and data binding, see Data Binding Overview.

重要

當元素的 DataContext 變更時,此專案上的所有資料系結屬性可能會受到影響。When an element's DataContext changes, all data-bound properties on this element are potentially affected. 這適用于任何專案,這些專案是目前專案的子代專案,它會繼承資料內容,以及目前的專案本身。This applies to any elements that are descendant elements of the current element, which inherit the data context, and also the current element itself. 所有這類系結都會重新解讀新的 DataContext,以反映系結中的新值。All such bindings re-interpret the new DataContext to reflect the new value in bindings. 不保證這些變更相對於引發 DataContextChanged 事件的順序。There is no guarantee made about the order of these changes relative to the raising of the DataContextChanged event. 這些變更可能會在事件發生之前、在事件之後,或在任何混合中進行。The changes can occur before the event, after the event, or in any mixture.

適用於