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 window.ShowDialog()
within my ViewModel. I know there is a DialogMessage
in MVVM Light, but that is used to show message boxes, not WPF modal windows.
Any ideas on how to do this?
Best Answer
You should use
Messenger
class. On theView
register a message to show window, and then when you need to show it callSend
method ofMessenger
class.You can do something like this: