I have a ViewModel that needs to show a modal window (using ShowDialog()) on a button click. The ViewModel catches the click command, but I don\'t want to do
You should use Messenger class. On the View register a message to show window, and then when you need to show it call Send method of Messenger class.
You can do something like this:
//do this in the code-behind file of your View
Messenger.Default.Register(this, ShowWindow);
private void ShowWindow(string message)
{
// your logic here
}
// In the ViewModel
Messenger.Default.Send(“Some text”);