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.DesktopPropertyDependencyAttribute

Namespace:  TomsToolbox.Desktop
Assembly:  TomsToolbox.Desktop (in TomsToolbox.Desktop.dll) Version: 1.0.70.0
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.

[NotNull, ItemNotNull]

Top
Methods
  NameDescription
Public methodStatic memberGetInvalidDependencies
Gets a list of invalid dependency definitions in the entry types assembly and all referenced assemblies.

[NotNull, ItemNotNull]

Top
Extension Methods
  NameDescription
Public Extension MethodSafeCastT
Performs a cast from object to T, avoiding possible null violations if T is a value type.

[CanBeNull]

(Defined by ObjectExtensions.)
Top
Examples
C#
class X : ObservableObject
{
    string Value { get { ... } }

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

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