dotnet / dotnet/winforms

Introduce PopupAsync on UserControl/Form

Open
#5,918 5 comments 3 reactions 0 assignees View on GitHub
api-suggestion tenet-modernization
Dominant language
C#
Stars
4.9k
Forks
1.1k
Avg merge
1d 13m
Merged PRs (30d)
85

Description

## Rationale

Since Windows 8, Windows introduced a popup-like Dialog for imfo messages or short input actions, which gets dismissed _just_ by clicking next to the Dialog. With that, it has a classic popup (menu) behavior.

Like this:

![image](https://user-images.githubusercontent.com/9663150/135931252-dad878e0-6584-456f-9f7b-f34adb5b11c6.png)

Currently, there are no means to utilize these kinds of Dialogs in WinForms. Together with #5917 and #4631, this API is not only an important extension for programming with the typical .NET async/await pattern - it also solves 2 requirements in modern, desktop UI design:

1. It makes Windows 8, 10, 11-typical popup-like Dialogs possible.
2. It is an easy extension for Popup-Controls which custom content.

### Proposed APIs:

```cs
var popupResult = await UserControl1.PopupAsync([IWin43Window owner]);
```

To show a UserControl in a popup-like Dialog style.

```cs
var popupResult = await UserControl1.PopupAsync(popupInitiateControl control);
```

To show a UserControl as a real popup to a parent control (like a TextBox with an attached down button to open the popup context). In this case, we should provide functionality, to attach the popup visually in a meaningful way to the parent control, to give the visual impression of both UI parts as a unit.

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.