I have multiple ViewModels and use ViewModelBase as an abstract class in all of them. I want to grab the current property values from one class in another. Creating an instance is not desirable, making the property static gets me what I want. However by doing this I lose out on the INotifyPropertyChange Im using with ViewModelBase.Set() since Set() is a non-static method.
Whats the alternative where I can get the property value, yet still keep the benefits of ViewModelBase in MVVM?
public class SampleViewModel : ViewModelBase
{
private static bool _sample;
public SampleViewModel()
{
}
public static bool GetValue
{
get { return _sample; }
set { Set(ref _sample, value); }
}
}
public class MyClassViewModel : ViewModelBase
{
public MyClassViewModel()
{
bool myValue = SampleViewModel.GetValue;
}
}