DependencyProperty.OwnerType Property

Definition

Gets the type of the object that registered the dependency property with the property system, or added itself as owner of the property.

public Type OwnerType { get; }

Property Value

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

Examples

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

Remarks

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.

Applies to

Product Versions
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9