Search code examples
c#wpfdevexpress-wpf

How to customize MessageBox prompts?


This routine is widely used to prompt Yes/No confirmations to the end users:

var result = DXMessageBox.Show(Application.Current.MainWindow, 
                                                   "Whatever", 
                                                  "Attention", 
                                    MessageBoxButton.OKCancel, ////////////// here
                                    MessageBoxImage.Question);

if (result == MessageBoxResult.OK) // then instead of this, it shall check some customized settings
{
    // confirmed for Orange for example
}
else
{
    // confirmed for Elephant for example
} 

I don't want YesNo, OKCancel or the others. How to customize the buttons? I want the user to be able to do something similar to "User presses a button, Application prompts two choices, User chooses one". But I want to combine specified Choices, Texts and Sizes with the simplicity of a MessageBox?

P.S DVMessageBox and System.Windows.MessageBox are almost similar here.


Solution

  • In my view, you want just to create Custom control. There are a lot articles:
    One
    Two
    Three

    In addition , you can create MessageBox fully customizable via standard WPF control templates. Please, see an example.