My Application layer uses DialogPresenters to show some ViewModels in various dialogs (modal, splash screen, etc..).
public DataImportDialogPresenter(DataImportViewModel viewModel, IDialogView shellView, IDialogView owner)
: base(viewModel, shellView, owner)
{
//Base sets the view data context etc.
//Monitor CancelCommand and close the dialog
viewModel.CancelCommand = new DelegateCommand(() => Terminate());
}
This setup works really well except for the fact that if my ViewModel decides it needs to do something on the CancelCommand (which is perfectly reasonable) then it will replace the presenter's call to Terminate() or vice-versa.
What I would like to do is:
viewModel.CancelCommand += new DelegateCommand(() => Terminate());
In the same spirit as attaching event handlers.
- Is this possible in C#.NET 3.5?
- How would I achieve it?
- Is this bad MVVM practice?
Thanks
D