Creating a flexible custom WPF dialog

Standard

In my current project, we had a need to create a custom WPF dialog box. Writing our own provides us the ability to easily skin the window with our application’s theme as well as gives us the ability to generate any buttons we wanted.

We wanted our custom dialog box to be able to:

  1. Display a message to the user
  2. Provide various button options (OK, OK/Cancel, Yes/No, Yes/No/Cancel, etc)
  3. Return the button clicked by the user
  4. Display an optional CheckBox
    • Display text next to the optional CheckBox
    • Accept a boolean property for the default IsChecked state of the optional CheckBox
    • Provide the IsChecked value of the optional CheckBox as an out parameter

Continue reading