I haveViewModel1
and View1 associated with it. I start dialog window from ViewModel2
(some another viewmodel) using IWindowManager
object. The code from ViewModel2
class:
windowManager.ShowDialog(new ViewModel());
So, I have Dialog Window with View1 user control.
My answer is next - I can close that dialog window using red close button, but how to close it using my specific button (contained in View1
user control), something like "Cancel" button with close command (Command={Binding CancelCommand}
), CancelCommand
of course is contained in ViewModel1
class.
It's even easier if your view model extends Caliburn.Micro.Screen
:
TryClose();