Click or drag to resize

RelayedEventAttribute Class

Attribute to mark one property to relay the property changed events of another property from the governing class. If you call OnPropertyChanged(String) for a property of the governing class, the property change event will also be raised for the relayed property.
Inheritance Hierarchy
SystemObject
  SystemAttribute
    TomsToolbox.WpfRelayedEventAttribute

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

The RelayedEventAttribute type exposes the following members.

Constructors
  NameDescription
Public methodRelayedEventAttribute(Type)
Initializes a new instance of the RelayedEventAttribute class.
Public methodRelayedEventAttribute(Type, String)
Initializes a new instance of the RelayedEventAttribute class.
Top
Properties
  NameDescription
Public propertySourceName
Gets the name of the source property, or null if the name is the same as the target property.
Public propertySourceType
Gets the type of the source for the events.
Top
Extension Methods
Examples
C#
class X : ObservableObject
{
    Y _governingObject;

    public X(Y governingObject)
    {
        _governingObject = governingObject;
        RelayEventsOf(_governingObject);
    }

    [RelayedEvent(typeof(Y))]
    string Value { get { return _governingObject.Value } }

    void ChageSomething()
    {
        _governingObject.Value = "new Value";
    }
}
Changing 'Y.Value' will also raise the PropertyChanged event for the "X.Value" property.
See Also