[MVVM Toolkit] Possibility to implement or override generated methods in child classes #895
hansmbakker
started this conversation in
Ideas
Replies: 1 comment
-
Note: I see for this specific case I could do something like below, but that requires filtering by property name and does not allow me to directly use those generated methods. internal partial class TestVmBase : ObservableObject
{
[ObservableProperty]
private bool? myProperty;
}
internal partial class TestVmChild : TestVmBase
{
[ObservableProperty]
private bool isModified;
protected override void OnPropertyChanged(PropertyChangedEventArgs e)
{
base.OnPropertyChanged(e);
if (e.PropertyName != nameof(this.IsModified))
{
this.IsModified = true;
}
}
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Currently it is possible to implement logic triggered by
ObservableProperty
members using generated methods likeHowever, those methods can only be implemented in the same class where the
MyProperty
[ObservableProperty]
is defined because they are not markedvirtual
.This prevents the following usecase:
@Sergio0694 would it be possible to have such functionality in the MVVM Toolkit?
Beta Was this translation helpful? Give feedback.
All reactions