Skip to content

Commit de0928f

Browse files
committed
fix: MessageBox not inherit Topmost
1 parent 5b5fd37 commit de0928f

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/Wpf.Ui.Violeta/Controls/MessageBox/MessageBoxDialog.cs

+5-5
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ protected override void OnSourceInitialized(EventArgs e)
382382
}
383383
}
384384

385-
private void OnButtonClick(object sender, RoutedEventArgs e)
385+
private void OnButtonClick(object? sender, RoutedEventArgs e)
386386
{
387387
if (sender == OKButton)
388388
{
@@ -531,13 +531,13 @@ private void UpdateMessageBoxButtonState()
531531
/// <returns>A <see cref="MessageBoxResult"/> value that specifies which message box button is clicked by the user.</returns>
532532
public new MessageBoxResult ShowDialog()
533533
{
534-
base.ShowDialog();
535-
536534
if (Owner != null)
537535
{
538536
// Inherit the topmost state from the owner window
539537
Topmost = Owner.Topmost;
540538
}
539+
540+
base.ShowDialog();
541541
return Result;
542542
}
543543

@@ -572,7 +572,7 @@ public void Close(MessageBoxResult result)
572572
}
573573
}
574574

575-
private void OnLoaded(object sender, RoutedEventArgs e)
575+
private void OnLoaded(object? sender, RoutedEventArgs e)
576576
{
577577
Loaded -= OnLoaded;
578578
Opened?.Invoke(this, new MessageBoxOpenedEventArgs());
@@ -586,7 +586,7 @@ private static void TryExecuteCommand(ICommand command, object parameter)
586586
}
587587
}
588588

589-
private void CopyExecuted(object sender, ExecutedRoutedEventArgs e)
589+
private void CopyExecuted(object? sender, ExecutedRoutedEventArgs e)
590590
{
591591
try
592592
{

0 commit comments

Comments
 (0)