tags:

views:

68

answers:

2

I want to show message box in my MVVM WPF application. so from where to call MessageBox.Show().

A: 

I've found that MVVM invokes a streak of OCD in programmers (I know from experience). That's a good thing. But for certain things the effort just isn't worth it, especially if it introduces an entire order of complexity just to ask the user "Are you sure you wish to xxxx?"

My opinion is that MessageBox.Show() may be called from the code-behind, but never the ViewModel. Until dialog boxes integrate better with XAML, just take the hit and don't feel bad about it. It's really a gray area of the current state of WPF UI design.

bufferz
I am using command so if i will have to show message box after button's can execute and Execute function, i need to pass some data to view's code behind file,Then it will break mvvm.
Jeevan Bhatt