Open JosefNemec opened 5 years ago
This is a good example, but some work has to be done in order to achieve the feature of notifying multiple properties when one changes. I suppose migrating to .NET Core is required first and that's probably why you set them to the same milestone.
CommunityToolkit.Mvvm uses attributes and source generators, is MIT-licensed, targets netstandard2.0
, and is highly optimized.
Right now we generate a lot of boilerplate code for properties used in classes implementing INotifyPropertyChanged. Basically all classes that bind to UI views (essentially any class inheriting from our
ObservableObject
).This is how it looks now:
And that's excluding value comparison in setter if we wanted to remove unnecessary notifications in case that value doesn't actually change.
It should ideally look like this:
Or this since we sometimes need to notify more properties for single setter:
Also it should be settable for the whole class in case we want to automatically notify all properties (with opt-out option for specific properties).
There are multiple ways to remove this boilerplate as far as I know:
Not matter what solution we choose it should support debugging of notify events. There are multiple areas of Playnite where performance can degrade drastically if unnecessary notify events are sent (for filter settings for example) and we should be able debug these cases easily.