Why can't [INotifyPropertyChanged] be used if something already implements the interface? #465
Unanswered
nightowl286
asked this question in
Q&A
Replies: 3 comments
|
FWIW: Its always good to show a code example that demonstrates the problem. This ensures everyone is discussing the same detail, and makes it easier to make suggestions. |
0 replies
|
As suggested, here is an example of the problem I was experiencing. interface ISomeInterface : INotifyPropertyChanged {
}
[INotifyPropertyChanged]
partial class SomeClass : ISomeInterface {
}In this example, I get the MVVMTK0001 error (on the |
0 replies
|
I support this feature request. If it's not possible in general, it would be helpful for me if Microsoft.Maui.Controls.BindableObject would be supported. I know, some hardcore MVVM fans may cry, but there's more than one way to get the job done. Edit: Like https://github.com/canton7/PropertyChanged.SourceGenerator |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
So the problem is that I can't use the attribute on a class that already implements the interface and I get the MVVMTK0001 error (among other ones if I try other workarounds) but is this check really necessary?
It prevents me from using my own interfaces (that then have a dependency on INotifyPropertyChanged) which makes it really annoying to use because then I have to structure my code in a specific way which obviously reduces the freedom of using the mvvm toolkit.
I can see why it might have been done so that there are no duplicate implementations of the interface, but surely just the regular C# errors would be enough for someone to realise that they have implemented it themselves as well.
All reactions