Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C#: Extended WPF Toolkit - Customixing Button Labels in a MessageBox

I would like to implement a message box in my wpf-project. The text is: "Choose Language:" The alternatives are English (OK) and German (Cancel).

In this context, I am trying to customize the buttons in the MessageBox. For doing this, I try to implement the Extended WPF Toolkit, but I have problems in terms of understanding the documentation for the Extended WPF Toolkit.

My code is like this:

"Xceed.Wpf.Toolkit.MessageBox msgBox = new Xceed.Wpf.Toolkit.MessageBox();
msgBox.OkButtonContent = "English";
msgBox.CancelButtonContent = "German";
MessageBoxResult result =msgBox.ShowMessageBox("Choose Language: ", "Language",MessageBoxButton.OKCancel);"

Questions:

1) Are the any other suitable controls to use where the user of the wpf application can choose among alternatives?

2) Where do I find some nice example/documentation for customizing button labels in a message box?

like image 934
user2791379 Avatar asked Dec 12 '22 11:12

user2791379


1 Answers

Just in code solution:

System.Windows.Style style = new System.Windows.Style();
style.Setters.Add(new Setter(Xceed.Wpf.Toolkit.MessageBox.YesButtonContentProperty, "Yes, FTW!"));
style.Setters.Add(new Setter(Xceed.Wpf.Toolkit.MessageBox.NoButtonContentProperty, "Omg, no"));
MessageBoxResult result = Xceed.Wpf.Toolkit.MessageBox.Show("My text", "My caption", MessageBoxButton.YesNo, MessageBoxImage.Warning, MessageBoxResult.Yes, style);

enter image description here

like image 58
pr0gg3r Avatar answered Dec 15 '22 01:12

pr0gg3r