tags:

views:

74

answers:

1

My goal was to enable the ViewModel to tell the View to present a MessageBox and ask the user a question.

I didn't want the ViewModel to have any reference to Windows-specific code.

I take the time to download and install MVVM Light Toolkit. Now I find that even with the toolkit, it is necessary for my ViewModel to reference System.Windows, in order to resolve things like MessageBoxButton and MessageBoxResult.

Why go through all this extra work, when you just wind up with a ViewModel that has a reference to System.Windows? I might as well call MessageBox.Show() straight from the ViewModel. Essentially I have saved nothing by using the MVVM toolkit, so I just don't understand why I would use this.

Can someone please explain to me, why go through this effort, if I still have to reference System.Windows in my ViewModel?

Thanks, Hugh

A: 

When you use MessageBox class, you need a reference to System.Windows.Forms.dll. MVVM-Light does NOT require this reference.

Rick Ratayczak