Skip to content

Commit

Permalink
New icon MessageBoxImage.Question
Browse files Browse the repository at this point in the history
  • Loading branch information
NotYoojun committed Dec 16, 2023
1 parent 390db9e commit eb7e896
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
};
Expand Down
4 changes: 4 additions & 0 deletions source/samples/WpfApp1/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down

0 comments on commit eb7e896

Please sign in to comment.