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

定義

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

public:
 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 default 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)

CustomDPProperty.GetMetadata(DependencyObjectType).DefaultValue;

}

備註

此屬性相當實用,如果從方法傳回的物件具有傳回值類型的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.

適用於

另請參閱