Created
August 10, 2019 05:43
-
-
Save gpeipman/cfc99a613d4397406b2d62c48684a09b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface IViewModel : INotifyPropertyChanged | |
{ | |
} | |
public class MvvmComponentBase : ComponentBase | |
{ | |
private IViewModel _viewModel; | |
public IViewModel ViewModel | |
{ | |
get { return _viewModel; } | |
set | |
{ | |
if(value != null) | |
{ | |
_viewModel.PropertyChanged -= (o, e) => StateHasChanged(); | |
value.PropertyChanged += (o, e) => StateHasChanged(); | |
} | |
_viewModel = value; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment