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

DependencyPropertyServices.GetDependencyProperty Method

GetDependencyProperty(Type, String)

Gets the System.Windows.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
System.Windows.DependencyProperty

The System.Windows.DependencyProperty instance.

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

Gets the System.Windows.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
System.Linq.Expressions.Expression<Func<T>> expression

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

Returns
Type Description
System.Windows.DependencyProperty

The System.Windows.DependencyProperty instance.

Type Parameters
Name Description
T

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

Gets the System.Windows.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
System.Linq.Expressions.Expression<Func<TClass, TProperty>> expression

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

Returns
Type Description
System.Windows.DependencyProperty

The System.Windows.DependencyProperty instance.

Type Parameters
Name Description
TClass
TProperty