Search code examples
c#wpfmessagebox

Get new Messagebox style - WPF


I am currently working on a Windows Presentation Foundation app and I need to make use of Message boxes.

However, their appearance seems to be a bit off.

Actual appearance:
Example of a Messagebox I get.

Expected appearance:
Example of the style I would like  to get.

Does anybody know, why this is and how to solve it? I tried everything listed here, but nothing worked.


Solution

  • I agree with Keithernet, build your own. Its more of an Input Dialog box. You may want to plan it to create a window, create it with ex: 4 parameters which you could override so you can apply them in the form including

    The title,
    The prompt you want the user to fill in
    optional default button 1 text
    optional default button 2 text.
    

    have the input value stored into a public property in the window for the text to be bound to during entry.

    If the user clicks the cancel button (or similar), clear the text entry and close the window. If ok button, just close the window.

    Then, when you call it with a YourWindow.ShowDialog(), upon return, you can look at the public property for that input text value.

    You could even do with a property / flag if the user cancelled directly or not. I have done similar in a couple of my WPF apps.