FrameworkElement.DataContextChanged FrameworkElement.DataContextChanged FrameworkElement.DataContextChanged FrameworkElement.DataContextChanged Event

定義

這個項目的資料內容變更時發生。Occurs when the data context for this element 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 the DataContext for an element changes, all data-bound properties on this element are potentially affected. 這適用於所有項目都會邏輯樹狀結構中目前項目的子項目繼承的資料內容,以及目前的項目本身。This applies to any elements that are child elements of the current element in the logical tree, which inherit the data context, and also the current element itself. 所有這類現有的繫結必須重新解譯新DataContext並會重新評估繫結結果。All such existing bindings must re-interpret the new DataContext and will reevaluate the binding results. 資料繫結引擎不具決定性的這些困擾,相對於引發順序DataContextChanged事件。The data binding engine is not deterministic about the order of these reevaluations, relative to the raising of the DataContextChanged event. 事件之後,或以任何混合,可以會在事件中之前, 發生的重新評估。The reevaluations can occur before the event, after the event, or in any mixture.

適用於

另請參閱