PostSharp.ILAPI ReferencePost­Sharp.​Patterns.​XamlDependency­Property­ServicesGet­Dependency­Property
Open sandboxFocus

DependencyPropertyServices.GetDependencyProperty Method

GetDependencyProperty(Type, String)

Gets the DependencyProperty object associated with a property of a given name for a given type.

Declaration
public static DependencyProperty GetDependencyProperty([Required] Type type, [Required] string propertyName)
Parameters
Type Name Description
Type type

The type for which the dependency property was registered.

String propertyName

The name of the property.

Returns
Type Description
DependencyProperty

The DependencyProperty instance.

GetDependencyProperty<T>(Expression<Func<T>>)

Gets the DependencyProperty object associated with a property of a given name for a given type. The property name and the property owner type are extracted from the expression argument.

Declaration
public static DependencyProperty GetDependencyProperty<T>([Required] Expression<Func<T>> expression)
Parameters
Type Name Description
Expression<System.Func<T>> expression

The lambda expression in the format () => new ClassName().PropertyName.

Returns
Type Description
DependencyProperty

The DependencyProperty instance.

Type Parameters
Name Description
T

GetDependencyProperty<TClass, TProperty>(Expression<Func<TClass, TProperty>>)

Gets the DependencyProperty object associated with a property of a given name for a given type. The property name and the property owner type are extracted from the expression argument.

Declaration
public static DependencyProperty GetDependencyProperty<TClass, TProperty>([Required] Expression<Func<TClass, TProperty>> expression)
Parameters
Type Name Description
Expression<Func<TClass, TProperty>> expression

The lambda expression in the format (ClassName x) => x.PropertyName.

Returns
Type Description
DependencyProperty

The DependencyProperty instance.

Type Parameters
Name Description
TClass
TProperty