I have a ViewModelBase that looks like the following:
public class ViewModelBase : BindableBase, INavigationAware, IActiveAware, IDockAware
{
public ViewModelBase() {SaveCommand = new DelegateCommand(OnSave, CanSave);}
public DelegateCommand SaveCommand { get; set; }
protected virtual void OnSave() { }
In my class I inherit from ViewModelBase like so:
public class FooViewVM : ViewModelBase
{
protected override async void OnSave() { await dto.Save(Foo); }
}
When I press the Save button (located in a Ribbon in a different group), the command executes but the code does not run the FooViewVM, but stops at the virtual void in ViewModelBase. I'm a little confused because I thought that the method in the VM would be executed (since it overrides the virtual method in the base). Do I have too many interfaces defined in the base classes? Should I move the DelegateCommand(s) into each VM instead of inheriting? And finally, I'd like to better understand why this isn't working like I expected.