Khalil Khalaf
Khalil Khalaf

Reputation: 9397

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.

Upvotes: 2

Views: 256

Answers (1)

StepUp
StepUp

Reputation: 38199

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.

Upvotes: 1

Related Questions