DependencyPropertyDescriptor.FromProperty Method

Definition

Returns a DependencyPropertyDescriptor based either on a provided PropertyDescriptor or a provided type, depending on the signature used.

Overloads

FromProperty(DependencyProperty, Type)

Returns a DependencyPropertyDescriptor for a provided dependency property and target type.

C#
public static System.ComponentModel.DependencyPropertyDescriptor FromProperty(System.Windows.DependencyProperty dependencyProperty, Type targetType);

Parameters

dependencyProperty
DependencyProperty

The identifier for a dependency property.

targetType
Type

The type of the object where the property is set.

Returns

A DependencyPropertyDescriptor for the provided dependency property.

Remarks

The dependencyProperty may refer to a dependency property or an attached property. targetType is the type of object you want to set the property for. For dependency properties, that type is equivalent to the OwnerType for the dependencyProperty. For attached properties the targetType is typically some other DependencyObject type.

Applies to

.NET Framework 4.8.1 and other versions
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, 10

FromProperty(PropertyDescriptor)

C#
public static System.ComponentModel.DependencyPropertyDescriptor FromProperty(System.ComponentModel.PropertyDescriptor property);

Parameters

property
PropertyDescriptor

The PropertyDescriptor to check.

Returns

If the property described by property is a dependency property, returns a valid DependencyPropertyDescriptor. Otherwise, returns a nullDependencyPropertyDescriptor.

Remarks

This method is the primary method used by designer applications to obtain a DependencyPropertyDescriptor on basis of checking all properties for a PropertyDescriptor.

Applies to

.NET Framework 4.8.1 and other versions
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, 10