PostSharpAPI ReferencePost­Sharp.​Patterns.​XamlDependency­Property­Attribute
Open sandboxFocus

DependencyPropertyAttribute Class

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)]
[HasConstraint]
[Serializer]
public sealed class DependencyPropertyAttribute : DependencyPropertyBaseAttribute, ILocationLevelAspect, ILocationLevelAspectBuildSemantics, IAspectBuildSemantics, IValidableAnnotation, IAspectProvider, IAspect, IService, ILocationValidationHandler
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.

SupportsRegistrationProperties

Methods

Name Description
CompileTimeValidate(LocationInfo)
GetPropertyName()
GetPropertyType()
OnPropertyGet<T>(Object, out T)
OnPropertyInitialized(LocationInitializationArgs)
OnPropertySet<T>(Object, ref T)
RegisterProperty(Type, Type)