dotnet / dotnet/winforms

Form's parent window is placed to the very back, when a child is hidden

Open
#9,585 21 comments 0 reactions 0 assignees View on GitHub
:beetle: bug
Dominant language
C#
Stars
4.9k
Forks
1.1k
Avg merge
20h 23m
Merged PRs (30d)
103

Description

### .NET version

All, e.g. .Net 4.7x or .Net 4.8.x

Seems to be a general issue inside the Windows API?

### Did it work in .NET Framework?

No

### Did it work in any of the earlier releases of .NET Core or .NET 5+?

No.

### Issue description

A form's parent window is hidden after a child form is placed on the form which is opened via the .Show(this) methid and the child form opens another child form, which both are then hidden.

Why this demo?
It is very obvious an very often the case, that you open a 3rd 'form' from within a child from, which was shown from a parent form.
E.g. many UI vendors, like DevExpress or Syncfusion use this to implement popup container controls.
Whenever you use such control within a modeless dialog, this odd behavior occurs and the parent form becomes invisible.

This behavior affects millions of users world wide, that's why I see this pretty critical and urgent.
I already addressed this to the above mentioned UI vendors and both told me to raise a ticket here.

### Steps to reproduce

[T1179595.zip](https://github.com/dotnet/winforms/files/12185511/T1179595.zip)

1. Run the attached project.
2. Click on the "Show(this)" item.
3. In the child form press ENTER to another "PopupForm".
4. Now press ESC twice.

Result: The main (root parent) form is hidden.
Expected: The main (root parent) stays visbible of course.

When you use the "Show()" method without a parent reference, the issue does not occur.

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.