From eb7e8968edf9d00486dd387e0c431c466d5f72ee Mon Sep 17 00:00:00 2001 From: NotYoojun Date: Sat, 16 Dec 2023 22:25:27 +0800 Subject: [PATCH] New icon MessageBoxImage.Question --- .../Controls/MessageBox/MessageBox.cs | 7 ++++++- .../Controls/MessageBox/MessageBoxImageExtensions.cs | 2 +- source/samples/WpfApp1/MainWindow.xaml.cs | 4 ++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/source/iNKORE.UI.WPF.Modern.Controls/Controls/MessageBox/MessageBox.cs b/source/iNKORE.UI.WPF.Modern.Controls/Controls/MessageBox/MessageBox.cs index dcdc1e29..e174b091 100644 --- a/source/iNKORE.UI.WPF.Modern.Controls/Controls/MessageBox/MessageBox.cs +++ b/source/iNKORE.UI.WPF.Modern.Controls/Controls/MessageBox/MessageBox.cs @@ -44,7 +44,7 @@ public MessageBox() SetValue(TemplateSettingsPropertyKey, new MessageBoxTemplateSettings()); var handler = new RoutedEventHandler((sender, e) => ApplyDarkMode()); ThemeManager.AddActualThemeChangedHandler(this, handler); - WindowHelper.SetSystemBackdropType(this, DefaultBackdropType); + Loaded += On_Loaded; } @@ -755,6 +755,11 @@ private void On_Loaded(object sender, RoutedEventArgs e) ApplyDarkMode(); this.RemoveTitleBar(); Opened?.Invoke(this, new MessageBoxOpenedEventArgs()); + + if (DefaultBackdropType == BackdropType.None || MicaHelper.IsSupported(DefaultBackdropType)) + { + WindowHelper.SetSystemBackdropType(this, DefaultBackdropType); + } } private static void TryExecuteCommand(ICommand command, object parameter) diff --git a/source/iNKORE.UI.WPF.Modern.Controls/Controls/MessageBox/MessageBoxImageExtensions.cs b/source/iNKORE.UI.WPF.Modern.Controls/Controls/MessageBox/MessageBoxImageExtensions.cs index 5f18808f..bb53b24c 100644 --- a/source/iNKORE.UI.WPF.Modern.Controls/Controls/MessageBox/MessageBoxImageExtensions.cs +++ b/source/iNKORE.UI.WPF.Modern.Controls/Controls/MessageBox/MessageBoxImageExtensions.cs @@ -12,7 +12,7 @@ public static string ToSymbol(this MessageBoxImage image) MessageBoxImage.Error => SegoeIcons.Error, MessageBoxImage.Information => SegoeIcons.Info, MessageBoxImage.Warning => SegoeIcons.Warning, - MessageBoxImage.Question => SegoeIcons.StatusCircleQuestionMark, + MessageBoxImage.Question => SegoeIcons.Unknown, MessageBoxImage.None => char.Parse("0x2007").ToString(), _ => throw new NotSupportedException(), }; diff --git a/source/samples/WpfApp1/MainWindow.xaml.cs b/source/samples/WpfApp1/MainWindow.xaml.cs index dc61b1d1..3737aecd 100644 --- a/source/samples/WpfApp1/MainWindow.xaml.cs +++ b/source/samples/WpfApp1/MainWindow.xaml.cs @@ -83,6 +83,10 @@ private void Button_MessageBox_Click(object sender, RoutedEventArgs e) //System.Windows.MessageBox.Show(message, title, MessageBoxButton.YesNoCancel, MessageBoxImage.Question); //System.Windows.MessageBox.Show("adawdawda", title, MessageBoxButton.YesNoCancel, MessageBoxImage.Question); + + + MessageBoxEx.DefaultBackdropType = BackdropType.None; + MessageBoxEx.Show("This is a test text!", "Some title", MessageBoxButton.YesNoCancel, MessageBoxImage.Question); MessageBoxEx.Show("aaa");