Edit

Share via


ObservableObjectAttribute Class

Definition

An attribute that indicates that a given type should have all the members from ObservableObject generated into it, as well as the INotifyPropertyChanged and INotifyPropertyChanging interfaces. This can be useful when you want the same functionality from ObservableObject into a class that already inherits from another one (since C# doesn't support multiple inheritance). This attribute will trigger the source generator to just create the same APIs directly into the decorated class.

This attribute can be used as follows:

[ObservableObject]
partial class MyViewModel : SomeOtherClass
{
    // Other members here...
}

And with this, the same APIs from ObservableObject will be available on this type as well.
[System.AttributeUsage(System.AttributeTargets.Class, AllowMultiple=false, Inherited=false)]
public sealed class ObservableObjectAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Class, AllowMultiple=false, Inherited=false)>]
type ObservableObjectAttribute = class
    inherit Attribute
Public NotInheritable Class ObservableObjectAttribute
Inherits Attribute
Inheritance
ObservableObjectAttribute
Attributes

Constructors

ObservableObjectAttribute()

Applies to