Open sandboxFocus

Method GetDependencyProperty

GetDependencyProperty(Type, string)

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

Declaration
public static DependencyProperty GetDependencyProperty(Type type, 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>(Expression<Func<T>> expression)
Parameters
Type Name Description
Expression<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>(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