dotnet / dotnet/wpf

Window.Close() does not close owned windows

Open
#6,757 1 comment 0 reactions 1 assignee Claimed by @pchaurasia14 View on GitHub
Investigate
Dominant language
C#
Stars
7.7k
Forks
1.3k
Avg merge
1d 11h
Merged PRs (30d)
61

Description

* .NET Core Version: 6.0
* Windows version: 20H2
* Does the bug reproduce also in WPF for .NET Framework 4.8?: Yes
* Is this bug related specifically to tooling in Visual Studio (e.g. XAML Designer, Code editing, etc...)? No



**Problem description:**
Window.Close() closes non-owned windows as documented.

See:
https://docs.microsoft.com/en-us/dotnet/api/system.windows.window.close?view=windowsdesktop-6.0
_Closing a Window causes any windows that it owns to be closed_

**Actual behavior:**

- ShowDialog() not returns on Close().
- ShowDialog() returns on MainWindow close.


**Expected behavior:**

- Owned windows are closed as documented.
- ShowDialog() returns.


**Minimal repro:**
[WindowCloseBug.zip](https://github.com/dotnet/wpf/files/9053163/WindowCloseBug.zip)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.