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 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)




此属性很有用,如果从方法返回的对象返回值类型为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.