I'm trying to share one BaseViewModel over multiple Views. Therefore I want to have the ViewModel implement different Interfaces, one for each View.
public class BaseViewModel : IBaseViewModelTypeI, IBaseViewModelTypeII {
public PropertyI { get; set; }
public PropertyII { get; set; }
}
public interface IBaseViewModelTypeI {
PropertyI { get; set; }
}
public interface IBaseViewModelTypeII {
PropertyII { get; set; }
}
In my View, I want to set the ViewModel as DataContext and expose only properties which are implemented in the Interface as bindable properties.
But WPF seems to resolve to the BaseType of my BaseViewModel and because of that exposes access to every Property defined in my BaseViewModel.
Is there any way to solve this or is this a bad pattern at all?