HC has rewritten a set of message dialogs, the usage is the same as the original one.
1
| public sealed class MessageBox : Window
|
Attributes
| Property |
Description |
Default Value |
Remarks |
| Message |
Message Content |
|
|
| Image |
Message Type Diagram |
|
|
| ImageBrush |
Message type diagram color |
|
|
| ShowImage |
Whether to display the message type schematic diagram |
false |
|
Method
| Name |
Description |
| Success(string, string) |
Show a success message |
| Info(string, string) |
Display a notification message |
| Warning(string, string) |
Display a warning message |
| Error(string, string) |
Display an error message |
| Fatal(string, string) |
Display a serious message |
| Ask(string, string) |
Display an inquiry message |
| Show(MessageBoxInfo) |
Show a custom message |
| Show(string, string, MessageBoxButton, MessageBoxImage, MessageBoxResult) |
Show a message |
| Show(Window, string, string, MessageBoxButton, MessageBoxImage, MessageBoxResult) |
Show a message |
Case
1
| MessageBox.Show("a new version has been detected!Do you want to update?", "Title", MessageBoxButton.YesNo, MessageBoxImage.Question);
|

Override styles
you can override styles like this:
first in your app.xaml add this:
1 2 3 4 5 6 7 8
| <Style x:Key="MessageBoxCustom" TargetType="hc:MessageBox" BasedOn="{StaticResource {x:Type hc:MessageBox}}"> <Setter Property="NonClientAreaBackground" Value="#262e2f"/> <Setter Property="OtherButtonHoverBackground" Value="#888580"/> <Setter Property="OtherButtonForeground" Value="White"/> <Setter Property="OtherButtonHoverForeground" Value="White"/> <Setter Property="NonClientAreaForeground" Value="White"/> <Setter Property="CloseButtonForeground" Value="White"/> </Style>
|
now you must set this style in your messagebox:
1 2 3 4 5 6 7 8 9
| MessageBox.Show(new MessageBoxInfo { Message = "Ask", Caption = "Title", Button = MessageBoxButton.YesNo, IconBrushKey = ResourceToken.AccentBrush, IconKey = ResourceToken.AskGeometry, StyleKey = "MessageBoxCustom" });
|
Customize Button Text
Only Available in Custom Version
1 2 3 4 5 6
| MessageBox.Show(new MessageBoxInfo { Message = "Ask", Caption = "Title", ConfirmContent = "Ok" });
|