DependencyProperty.OwnerType DependencyProperty.OwnerType DependencyProperty.OwnerType DependencyProperty.OwnerType Property

定義

取得對屬性系統註冊相依性屬性之物件,或將本身作為屬性擁有者加入之物件的類型。Gets the type of the object that registered the dependency property with the property system, or added itself as owner of the property.

public:
 property Type ^ OwnerType { Type ^ get(); };
public Type OwnerType { get; }
member this.OwnerType : Type
Public ReadOnly Property OwnerType As Type

屬性值

註冊屬性或將本身作為屬性擁有者加入的物件類型。The type of the object that registered the property or added itself as owner of the property.

範例

下列範例會根據相依性屬性識別碼dp取得擁有者類型, 然後取得該相同識別碼之擁有者類型的中繼資料。The following example gets the owner type based on a dependency property identifier dp, and then gets metadata on the owner type for that same identifier. 此作業實際上相當於取得DefaultMetadatadpThis operation is actually equivalent to getting DefaultMetadata on dp.

pm = dp.GetMetadata(dp.OwnerType);
pm = dp.GetMetadata(dp.OwnerType)

備註

在屬性註冊期間提供此值。This value was provided during property registration. 如果DependencyPropertyAddOwner從呼叫產生的識別碼, 則擁有者將會是原始註冊類型, 或是在呼叫所產生之DependencyProperty識別碼的情況下, 將本身新增為擁有者的類型。 RegisterThe owner will be either the original registering type in the case of a DependencyProperty identifier generated from a Register call, or the type that added itself as owner in the case of a DependencyProperty identifier generated from an AddOwner call.

任何OwnerType指定DependencyProperty的上的都是不可變的null , 而且不DependencyProperty能是有效的。The OwnerType on any given DependencyProperty is immutable, and cannot be null in a valid DependencyProperty.

適用於