Open sandboxFocus

Class DependencyPropertyAttribute

Custom attribute that, when applied on an automatic property, turns this property into a XAML dependency property of the same name.

Namespace: PostSharp.Patterns.Xaml
Assembly: PostSharp.Patterns.Xaml.dll
Syntax
[MulticastAttributeUsage(PersistMetaData = true)]
[ComVisible(false)]
[Serializer(typeof(DependencyPropertyAttribute.Serializer))]
public sealed class DependencyPropertyAttribute : DependencyPropertyBaseAttribute, ILocationLevelAspect, ILocationLevelAspectBuildSemantics, IAspectBuildSemantics, IValidableAnnotation, IAspectProvider, IAspect, IService
Remarks

Suppose the target property is named Foo. If a method named ValidateFoo exists in the class, it will be used to validate the values assigned to this property. If a method named OnFooChanged exists in the class, it will be invoked whenever the property set. If a property named FooProperty exists in the class, it will be assigned to the corresponding DependencyProperty instance. Naming conventions can be overridden by the ValidateValueMethod, PropertyChangedMethod and RegistrationProperty aspect properties.

Constructors

Name Description
DependencyPropertyAttribute()
DependencyPropertyAttribute(PortableFormatterConstructorContext)

Properties

Name Description
DefaultValue

Gets or sets the initial value of the dependency property and the DefaultValue property of the dependency property metadata. If you set this property, do not use a property initializer.