diff --git a/src/BitzArt.Blazor.MVVM/Models/ComponentViewModel.cs b/src/BitzArt.Blazor.MVVM/Models/ComponentViewModel.cs index 465d021..7481500 100644 --- a/src/BitzArt.Blazor.MVVM/Models/ComponentViewModel.cs +++ b/src/BitzArt.Blazor.MVVM/Models/ComponentViewModel.cs @@ -37,7 +37,11 @@ public abstract class ComponentViewModel : ComponentViewModel, IStateful public object ComponentState { get => State; - set => State = (TState)value; + set + { + State = (TState)value; + OnStateChanged(State); + } } /// @@ -57,4 +61,9 @@ public virtual Task InitializeStateAsync() { return Task.CompletedTask; } + + /// + /// Called when the state has changed. + /// + protected virtual void OnStateChanged(TState state) { } }