-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
Description
When a Window has an owned modal dialog open, the dialog does not correctly come to the foreground with the owner window when the application is restored after being obscured. This breaks the expected modal behavior, as the owner window appears on top, disabled, while the active modal dialog remains hidden behind other applications.
Visual Studio also use WPF, but it's modal dialog doesn't has this problem, maybe it has been fixed internally?
Reproduction Steps
- In the Showcase application, click the "Open modal child window" button to open a standard modal dialog.
- Click the "Show Desktop" button in the taskbar.
- Click on Any Other application window from the taskbar, then the Showcase will be bring back to the foreground.
<Window x:Class="WpfApp1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
<Grid>
<Button Content="Open modal child window" Click="Button_Click"/>
</Grid>
</Window>
using System.Windows;
namespace WpfApp1
{
public partial class MainWindow
{
public MainWindow()
{
InitializeComponent();
}
private void Button_Click(object sender, RoutedEventArgs e)
{
var window = new MainWindow { Owner = this };
window.ShowDialog();
}
}
}
Expected behavior
Both the owner window and its modal dialog should be brought to the foreground, with the dialog appearing on top of the main window and having focus.
Actual behavior
Only the owner window is brought to the foreground. It is correctly disabled and unresponsive, but the modal dialog that should be active remains hidden behind other application windows.
Regression?
No response
Known Workarounds
No response
Impact
No response
Configuration
Windows 11 (26100.4946)
.NET 9
Other information
No response