DependencyObject.DependencyObjectType DependencyObject.DependencyObjectType DependencyObject.DependencyObjectType DependencyObject.DependencyObjectType Property


取得包裝此執行個體之 CLRCLR 型別的 DependencyObjectTypeGets the DependencyObjectType that wraps the CLRCLR type of this instance.

 property System::Windows::DependencyObjectType ^ DependencyObjectType { System::Windows::DependencyObjectType ^ get(); };
public System.Windows.DependencyObjectType DependencyObjectType { get; }
member this.DependencyObjectType : System.Windows.DependencyObjectType
Public ReadOnly Property DependencyObjectType As DependencyObjectType


包裝此執行個體之 CLRCLR 型別的 DependencyObjectTypeA DependencyObjectType that wraps the CLRCLR type of this instance.


在下列虛擬程式碼範例MySubClass中, 預期其他衍生類別可能會變更相依性屬性MyCustom的預設值。In the following pseudocode example, MySubClass anticipates that additional derived classes might change the default value of the MyCustom dependency property. 此類別會執行無參數的函式, 該函式可在DependencyObjectType每次使用該函式做為衍生類別 instantiator 時, 利用值的多型來判斷實際的衍生類別。The class implements a parameterless constructor that can determine the actual derived class by taking advantage of polymorphism on the DependencyObjectType value whenever that constructor is used as a derived class instantiator.

public DOClass() : base()


__customPropertyCache = (CustomDP)




如果從方法傳回的物件具有的傳回值型DependencyObject別, 而且您想要根據其型別執行屬性系統特定的作業, 這個屬性就很有用。This property is useful if an object that is returned from a method has a return value type of DependencyObject and you want to perform property system specific operations on it depending on its type. 例如, GetMetadata(DependencyObjectType) DependencyObjectType使用而非CLRCLR類型呼叫, 會更有效率。For example it is more efficient to call GetMetadata(DependencyObjectType) using the DependencyObjectType rather than the CLRCLR type. DependencyObjectType加速查詢速度。DependencyObjectType facilitates faster lookup.