fixed a bug of MessageBox

This commit is contained in:
NaBian 2019-10-21 22:06:56 +08:00
parent 42f17c4626
commit 4872b8e25c
3 changed files with 7 additions and 7 deletions

View File

@ -23,12 +23,12 @@ namespace HandyControlDemo.UserControl
{
MessageBox.Show(new MessageBoxInfo
{
MessageBoxText = Properties.Langs.Lang.GrowlAsk,
Message = Properties.Langs.Lang.GrowlAsk,
Caption = Properties.Langs.Lang.Title,
Button = MessageBoxButton.YesNo,
IconBrushKey = ResourceToken.AccentBrush,
IconKey = ResourceToken.AskGeometry,
Style = ResourceHelper.GetResource<Style>("MessageBoxCustom")
StyleKey = "MessageBoxCustom"
});
}

View File

@ -267,7 +267,7 @@ namespace HandyControl.Controls
MessageBox messageBox = null;
Application.Current.Dispatcher.Invoke(new Action(() =>
{
messageBox = CreateMessageBox(null, info.MessageBoxText, info.Caption, info.Button, MessageBoxImage.None, info.DefaultResult);
messageBox = CreateMessageBox(null, info.Message, info.Caption, info.Button, MessageBoxImage.None, info.DefaultResult);
SetButtonStatus(messageBox, info.Button);
if (!string.IsNullOrEmpty(info.IconKey))
@ -277,9 +277,9 @@ namespace HandyControl.Controls
messageBox.ImageBrush = ResourceHelper.GetResource<Brush>(info.IconBrushKey);
}
if (info.Style != null)
if (info.StyleKey != null)
{
messageBox.Style = info.Style;
messageBox.Style = ResourceHelper.GetResource<Style>(info.StyleKey);
}
SystemSounds.Asterisk.Play();
messageBox.ShowDialog();

View File

@ -4,7 +4,7 @@ namespace HandyControl.Data
{
public class MessageBoxInfo
{
public string MessageBoxText { get; set; }
public string Message { get; set; }
public string Caption { get; set; }
@ -16,6 +16,6 @@ namespace HandyControl.Data
public MessageBoxResult DefaultResult { get; set; } = MessageBoxResult.None;
public Style Style { get; set; }
public string StyleKey { get; set; }
}
}