4

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.

Dante
  • 3,208
  • 9
  • 38
  • 56
  • possible duplicate of [How do make modal dialog in WPF?](http://stackoverflow.com/questions/499294/how-do-make-modal-dialog-in-wpf) – H.B. May 16 '12 at 19:26

1 Answers1

4

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

Community
  • 1
  • 1
Bojin Li
  • 5,769
  • 2
  • 24
  • 37
  • 1
    using Window.ShowDialog. is not a MMV conform solution. The ViewModel should not access the View. – Kux Sep 06 '21 at 15:50
  • @kux The ViewModel doesn't have to if you use an event in code-behind ;) But I agree, it should be a Command in the ViewModel while also not knowing about the View. – Clonkex Nov 15 '21 at 04:39