bramborman / NotifyPropertyChangedBase

A simple to use yet powerful implementation of INotifyPropertyChanged.
https://www.nuget.org/packages/NotifyPropertyChangedBase/
MIT License
10 stars 1 forks source link

Add connected properties #35

Open bramborman opened 6 years ago

bramborman commented 6 years ago

Let's have two properties:

int X
{
    get { return (int)GetValue(); }
    set { SetValue(value); }
}
int Y
{
    get { return X + 1; }
}

In this case, Y depends on X and if we want to bind to Y we have to manually invoke the PropertyChanged event everytime X changes.

So if we added a new overload/method, or maybe changed RegisterXXXProperty methods to have optional arguments while adding a new one to pass names of properties for which the event should be invoked, this could easily be automated.

bramborman commented 6 years ago

There could also be a different way, such as something like Connected properties. Connected property would be property bound to a different property using converter. But that would disallow connecting more than two properties or at least made it harder.