PropertyMetadata.PropertyChangedCallback Property

Definition

Gets or sets a reference to a PropertyChangedCallback implementation specified in this metadata.Gets or sets a reference to a PropertyChangedCallback implementation specified in this metadata.

public:
 property System::Windows::PropertyChangedCallback ^ PropertyChangedCallback { System::Windows::PropertyChangedCallback ^ get(); void set(System::Windows::PropertyChangedCallback ^ value); };
public System.Windows.PropertyChangedCallback PropertyChangedCallback { get; set; }
member this.PropertyChangedCallback : System.Windows.PropertyChangedCallback with get, set
Public Property PropertyChangedCallback As PropertyChangedCallback

Property Value

PropertyChangedCallback

PropertyChangedCallback 實作參考。A PropertyChangedCallback implementation reference.

Exceptions

Cannot set a metadata property once it is applied to a dependency property operation.Cannot set a metadata property once it is applied to a dependency property operation.

Remarks

屬性中繼資料中的回呼通常不是定義型別上的公用成員,因此,對於只使用現有相依性屬性中繼資料的大多數案例而言,這個屬性的值並不重要。The callbacks in property metadata are not typically public members on the defining type, so the value of this property is not important for most scenarios that just consume an existing dependency property's metadata. 公開此屬性的其中一個原因是,如果基底中繼資料和覆寫/新增中繼資料都指定了 PropertyChangedCallback,中繼資料類別就可以執行其所需的合併邏輯。One reason this property is exposed is so that metadata classes can perform their desired merge logic if both base metadata and overriding/adding metadata specify a PropertyChangedCallback. 的預設合併邏輯是要維護資料表中的所有 PropertyChangedCallback 的執行,並呼叫每一個,並使用由第一個執行之階層中最深層的類別所建立的回呼。The default merge logic for is to maintain all PropertyChangedCallback implementations in a table and call each of them, with callbacks established by the deepest class in hierarchy running first.

PropertyChangedCallback 在物件模型中定義為讀寫。PropertyChangedCallback is defined in the object model as read-write. 這是為了 PropertyChangedCallback 可以在初始化 PropertyMetadata 物件本身之後調整。This is so PropertyChangedCallback can be adjusted after initialization of the PropertyMetadata object itself. 不過,一旦取用中繼資料做為 RegisterAddOwnerOverrideMetadata呼叫的一部分,屬性系統就會密封該中繼資料實例,而屬性現在會被視為不變。However, once the metadata is consumed as part of a call to Register, AddOwner, or OverrideMetadata, the property system will seal that metadata instance and the properties are now considered immutable. 嘗試設定 PropertyChangedCallback 一次 IsSealed 在此中繼資料實例上 true 會引發例外狀況。Attempting to set PropertyChangedCallback once IsSealed is true on this metadata instance will raise an exception.

Applies to