Open sandboxFocus

Class AttachedPropertyAttribute

Custom attribute that, when applied on a static automatic property and of type Attached<T> turns this property into a XAML dependency property of the same name and whose value type is T.

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

Supposed 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 PostSharp.Patterns.Xaml.DependencyPropertyBaseAttribute.ValidateValueMethod, PostSharp.Patterns.Xaml.DependencyPropertyBaseAttribute.PropertyChangedMethod and PostSharp.Patterns.Xaml.DependencyPropertyBaseAttribute.RegistrationProperty aspect properties.

Constructors

Name Description
AttachedPropertyAttribute()
AttachedPropertyAttribute(PortableFormatterConstructorContext)