Answered by:
ICON

Question
-
Hi;
they can use a different icon, or png?
const string message ="Seçtiğiniz Kayıt Veri Tabanından Silinecektir."; const string caption = "Belge Silme"; if (documentID != 0) { var result = MessageBox.Show(message, caption, MessageBoxButton.YesNo, MessageBoxImage.Warning); if (result == MessageBoxResult.Yes) {
Thanks;
Sunday, November 29, 2015 8:08 PM
Answers
-
Yes, you can tell it to use one of an enumeration.
I have an mvvm orientated sample which covers that:
The icon can be set by a parameter on the show method:
https://msdn.microsoft.com/en-us/library/ms598709(v=vs.110).aspx
https://msdn.microsoft.com/en-us/library/system.windows.messageboximage(v=vs.110).aspx
eg
string message = "Are you sure?"; string caption = "Confirmation"; MessageBoxButton buttons = MessageBoxButton.YesNo; MessageBoxImage icon = MessageBoxImage.Question; if (MessageBox.Show(message, caption, buttons, icon) == MessageBoxResult.OK)
http://www.c-sharpcorner.com/UploadFile/mahesh/messagebox-in-wpf/
- Proposed as answer by Ed Price - MSFTMicrosoft employee Thursday, December 3, 2015 8:37 PM
- Marked as answer by Xavier Xie-MSFT Thursday, December 10, 2015 2:04 AM
Sunday, November 29, 2015 8:50 PM -
I guess your question is whether you can replace any of the built-in icons defined by the MessageBoxImage enumeration with a custom message.
The answer to that question is no because the MessageBox.Show message accepts a System.Window.MessageBoxImage value only, i.e. you can only use any of these values: https://msdn.microsoft.com/en-us/library/system.windows.messageboximage%28v=vs.110%29.aspx
If you want to use your own custom icon/image, you could create your own custom MessageBox class. Please refer to the following page for more information about this: http://stackoverflow.com/questions/6560493/messagebox-show-custom-icon
Hope that helps.
Please remember to close your threads by marking helpful posts as answer and then start a new thread if you have a new question. Please don't ask several questions in the same thread.
- Proposed as answer by Ed Price - MSFTMicrosoft employee Thursday, December 3, 2015 8:38 PM
- Marked as answer by Xavier Xie-MSFT Thursday, December 10, 2015 2:04 AM
Monday, November 30, 2015 2:53 PM
All replies
-
Yes, you can tell it to use one of an enumeration.
I have an mvvm orientated sample which covers that:
The icon can be set by a parameter on the show method:
https://msdn.microsoft.com/en-us/library/ms598709(v=vs.110).aspx
https://msdn.microsoft.com/en-us/library/system.windows.messageboximage(v=vs.110).aspx
eg
string message = "Are you sure?"; string caption = "Confirmation"; MessageBoxButton buttons = MessageBoxButton.YesNo; MessageBoxImage icon = MessageBoxImage.Question; if (MessageBox.Show(message, caption, buttons, icon) == MessageBoxResult.OK)
http://www.c-sharpcorner.com/UploadFile/mahesh/messagebox-in-wpf/
- Proposed as answer by Ed Price - MSFTMicrosoft employee Thursday, December 3, 2015 8:37 PM
- Marked as answer by Xavier Xie-MSFT Thursday, December 10, 2015 2:04 AM
Sunday, November 29, 2015 8:50 PM -
I guess your question is whether you can replace any of the built-in icons defined by the MessageBoxImage enumeration with a custom message.
The answer to that question is no because the MessageBox.Show message accepts a System.Window.MessageBoxImage value only, i.e. you can only use any of these values: https://msdn.microsoft.com/en-us/library/system.windows.messageboximage%28v=vs.110%29.aspx
If you want to use your own custom icon/image, you could create your own custom MessageBox class. Please refer to the following page for more information about this: http://stackoverflow.com/questions/6560493/messagebox-show-custom-icon
Hope that helps.
Please remember to close your threads by marking helpful posts as answer and then start a new thread if you have a new question. Please don't ask several questions in the same thread.
- Proposed as answer by Ed Price - MSFTMicrosoft employee Thursday, December 3, 2015 8:38 PM
- Marked as answer by Xavier Xie-MSFT Thursday, December 10, 2015 2:04 AM
Monday, November 30, 2015 2:53 PM