DependencyObject.DependencyObjectType Eigenschaft
Definition
Ruft das ab DependencyObjectType , das den CLR-Typ dieser Instanz umschließt.Gets the DependencyObjectType that wraps the CLR 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
Eigenschaftswert
Ein DependencyObjectType , der den CLR-Typ dieser Instanz umschließt.A DependencyObjectType that wraps the CLR type of this instance.
Beispiele
Im folgenden Pseudo Codebeispiel wird MySubClass
von erwartet, dass zusätzliche abgeleitete Klassen möglicherweise den Standardwert der MyCustom
Abhängigkeits Eigenschaft ändern.In the following pseudocode example, MySubClass
anticipates that additional derived classes might change the default value of the MyCustom
dependency property. Die-Klasse implementiert einen Parameter losen Konstruktor, der die tatsächliche abgeleitete Klasse ermitteln kann, indem Sie die Vorteile von Polymorphie für den DependencyObjectType Wert verwendet, wenn dieser Konstruktor als abgeleiteter klasseninstanzierer verwendet wird.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)
CustomDPProperty.GetMetadata(DependencyObjectType).DefaultValue;
}
Hinweise
Diese Eigenschaft ist nützlich, wenn ein Objekt, das von einer Methode zurückgegeben wird, über einen Rückgabe Werttyp von verfügt DependencyObject und Sie abhängig vom Typ systemspezifische Vorgänge für das System ausführen möchten.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. Beispielsweise ist es effizienter, GetMetadata(DependencyObjectType) mit DependencyObjectType anstelle des CLR-Typs aufzurufen.For example it is more efficient to call GetMetadata(DependencyObjectType) using the DependencyObjectType rather than the CLR type. DependencyObjectType ermöglicht eine schnellere Suche.DependencyObjectType facilitates faster lookup.