Click or drag to resize

PropertyDependencyAttribute Class

Attribute to mark one property as dependent on another property. If you call OnPropertyChanged(String) for one property, the property change event will also be raised for all dependent properties.
Inheritance Hierarchy
SystemObject
  SystemAttribute
    TomsToolbox.WpfPropertyDependencyAttribute

Namespace:  TomsToolbox.Wpf
Assembly:  TomsToolbox.Wpf (in TomsToolbox.Wpf.dll)
Syntax
[AttributeUsageAttribute(AttributeTargets.Property)]
[CLSCompliantAttribute(false)]
public sealed class PropertyDependencyAttribute : Attribute

The PropertyDependencyAttribute type exposes the following members.

Constructors
  NameDescription
Public methodPropertyDependencyAttribute
Initializes a new instance of the PropertyDependencyAttribute class.
Top
Properties
  NameDescription
Public propertyPropertyNames
Gets the names of the properties that the attributed property depends on.
Top
Methods
  NameDescription
Public methodStatic memberCreateDependencyMapping
Creates the dependency mapping from the attributes of the properties of the specified type.
Public methodStatic memberGetInvalidDependencies
Gets a list of invalid dependency definitions in the entry types assembly and all referenced assemblies.
Top
Extension Methods
Examples
C#
class X : ObservableObject
{
    string Value { get { ... } }

    [PropertyDependency("Value")]
    int ValueLength { get { ... } }

    void ChangeSomething()
    {
        OnPropertyChanged("Value");
    }
}
Calling 'OnPropertyChanged("Value")' will raise the PropertyChanged event for the "Value" property as well as for the dependent "ValueLength" property.
See Also