Modal dialog fails to activate with owner window when restoring app
- Dominant language
- C#
- Stars
- 7.7k
- Forks
- 1.3k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 61
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
1. In the Showcase application, click the "Open modal child window" button to open a standard modal dialog.
2. Click the "Show Desktop" button in the taskbar.
3. Click on Any Other application window from the taskbar, then the Showcase will be bring back to the foreground.
```csharp
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_
Contributor guide
Assessment
This issue has not been assessed yet.