Alex Rivera | Logout

WPF popup window

Asked 2012-07-16T07:36:13.683
37

I would like to let the user choose their options after a button is clicked. For example, showing two buttons, "Restart Now" and "Restart Later" in a modal popup window would be my preference. Using a MessageBox is not a solution for me as it does not allow the user to change the title of buttons.

Edit
Report

1 Answer

50

You need to create a new Window class. You can design that then any way you want. You can create and show a window modally like this:

MyWindow popup = new MyWindow();
popup.ShowDialog();

You can add a custom property for your result value, or if you only have two possible results ( + possibly undeterminate, which would be null), you can set the window's DialogResult property before closing it and then check for it (it is the value returned by ShowDialog()).

answered 2012-07-16T07:47:07.087

Your Answer