Modal Dialog in WPF

Dante picture Dante · May 16, 2012 · Viewed 18.6k times · Source

Here is my problem: I am migrating an application from Windows Forms to WPF, but I am totally new in WPF technology.

I have been lucky creating a ribbon also have been able to add some elements to it, but right now I am struggling to create a modal dialog.

How can I achieve this? I have already created all the design of the dialog, but I cannot get it open as a modal window.

Besides, since this application has to be developed under MVVM pattern, where could I place that code? According to what I've read, that code has to be place in the view class, am I right?.

Thank you in advance.

Answer

Bojin Li picture Bojin Li · May 16, 2012

You show a WPF Window modally using Window.ShowDialog. Also this WPF Window Overview will help.

Besides, since this application has to be developed under MVVM pattern, where could I place that code?

Look under the Related questions to your right, there are many answers to this question in there. For example:

Open dialog in WPF MVVM