Open hawkerm opened 1 year ago
It would be nice for integrating with Caliburn.Micro base classes for screens and conductors.
I have a similar use case for writing custom controls in Maui, they inherit already from 'ContentView' which implements INotifyPropertyChanged. Have some properties that I would like to add an ObservableProperty attribute to but it's not currently possible.
Overview
For instance, I already have a class I'm using which inherits from
INotifyPropertyChanged
. In my scenario, it'sObservableCollection
, so I can't modify it as it's in the BCL.It already has an
OnPropertyChanged
helper andPropertyChanged
event:It would be great if I could still use some or all of the MVVM attributes for source generators like
[ObservableProperty]
when inheriting from these classes in my own class.API breakdown
N/A uses existing attributes.
Usage example
For instance, I have a class already inheriting from this:
Worst case, let me have to re-specify that I want whatever's needed to polyfill, either with
INotifyPropertyChanged
orObservableObject
:Basically the existing generator in this case would spit out all the same stuff except what's already implemented by the type (in the case of
ObservableCollection
it'd be the following:If there's any conflict for some particular type, then raise an analytic warning/error.
Breaking change?
No
Alternatives
Can't use MVVM Toolkit generators or helpers? 😥
Additional context
Don't know if I know enough to help here. Had a hard time trying to understand how the existing code was generated with the new fanciness...
Help us help you
Yes, if someone can help (I'm not sure I understand where the current
INotifyPropertyChanged
generator is and how it works. Nor do I know if I know how to detect if something inherits or has the required methods to skip outputting them... but beyond that, I'd be willing to assist giving it a go if pointed in the right directions.