Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce PopupAsync on UserControl/Form #5918

Open
Tracked by #10739
KlausLoeffelmann opened this issue Oct 4, 2021 · 5 comments
Open
Tracked by #10739

Introduce PopupAsync on UserControl/Form #5918

KlausLoeffelmann opened this issue Oct 4, 2021 · 5 comments
Labels
api-suggestion (1) Early API idea and discussion, it is NOT ready for implementation tenet-modernization Modernizing WinForms UI
Milestone

Comments

@KlausLoeffelmann
Copy link
Member

KlausLoeffelmann commented Oct 4, 2021

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

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:

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

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

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.

@KlausLoeffelmann KlausLoeffelmann added the api-suggestion (1) Early API idea and discussion, it is NOT ready for implementation label Oct 4, 2021
@KlausLoeffelmann KlausLoeffelmann changed the title Introduce PopupAsync on UserControl/Form [WIP} Introduce PopupAsync on UserControl/Form Oct 4, 2021
@KlausLoeffelmann KlausLoeffelmann changed the title [WIP} Introduce PopupAsync on UserControl/Form [WIP] Introduce PopupAsync on UserControl/Form Oct 4, 2021
@dotnet dotnet locked and limited conversation to collaborators Oct 4, 2021
@KlausLoeffelmann
Copy link
Member Author

Locked this for now, since the concept is still work in progress.

@KlausLoeffelmann
Copy link
Member Author

Unlocked. Let's go from here.

@KlausLoeffelmann KlausLoeffelmann changed the title [WIP] Introduce PopupAsync on UserControl/Form Introduce PopupAsync on UserControl/Form Jan 9, 2022
@tbolon
Copy link
Contributor

tbolon commented Feb 2, 2022

Is this popup intended to be a "layer" (with a mask) on top of the owner form / control ? Or an independent "window" ?

The popup used on windows is a real window, which seems to capture the focus and is dismissed automatically when clicking anywhere outside. It can expand outside the app boundaries.

image

@KlausLoeffelmann
Copy link
Member Author

In my mind: The latter. 😄
But I'd need to investigate more closely. The idea also is to have a dropdown mechanisam, so we could host UserControl content in a dropdown. Like the Data Binding Picker does.

Sorry for the late response.

@janseris
Copy link

janseris commented May 20, 2023

Why does this use async/await function call? What would be the difference if it didn't?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api-suggestion (1) Early API idea and discussion, it is NOT ready for implementation tenet-modernization Modernizing WinForms UI
Projects
None yet
Development

No branches or pull requests

6 participants