Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

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.

Namespace:  System.Windows
Assembly:  WindowsBase (in WindowsBase.dll)
public Type OwnerType { get; }

Property Value

Type: System.Type
The type of the object that registered the property or added itself as owner of the property.

This value was provided during property registration. The 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.

The OwnerType on any given DependencyProperty is immutable, and cannot be null in a valid DependencyProperty.

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. This operation is actually equivalent to getting DefaultMetadata on dp.

pm = dp.GetMetadata(dp.OwnerType);

More Code

How to: Implement a Dependency PropertyThis example shows how to back a common language runtime (CLR) property with a DependencyProperty field, thus defining a dependency property. When you define your own properties and want them to support many aspects of Windows Presentation Foundation (WPF) functionality, including styles, data binding, inheritance, animation, and default values, you should implement them as a dependency property.

.NET Framework

Supported in: 4.5.1, 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows Phone 8.1, Windows Phone 8, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
© 2014 Microsoft. All rights reserved.