In a WPF application I have to get one line of info from user and I wan’t to use a Modal Dialog. However there seems to be no preset dialog for this. What’s a simple and easy way to do this. I find it somwhat complicated trying to find this out with the many versions of Dialogs and such.
Already I have had to use OpenFileDialog and SaveFileDialog. What is the different between version of these like Microsoft.Win32 and System.Windows.Form ?
There’s nothing special you need to do to show a modal dialog in WPF. Just add a
Windowto your project (let’s say the class name isMyDialog), and then do:Window.ShowDialogtakes care of showing the window in a modal manner.Example:
In your code somewhere: