dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
22.24k stars 1.76k forks source link

Windows of the same application can have an "always on top" of another window (from the same application) #11778

Open zxcAsk opened 1 year ago

zxcAsk commented 1 year ago

Description

This is mostly for desktop use case.

I would love a way to set a windows object to be the parent of a another window or a way to organize the z axis of the windows. that way a dialog can be design to be always of top of its supposed parent window. Similar to how Save Dialogs are on top of the notepad app and the the prompt "Do you want to replace it?" dialog is always on top of the save dialog. except instead of generic save file dialogs and yes/no dialog, a custom window/contentpage is being displayed in the dialog.

public void ShowDialog()
{
    Window dialogWindow = new Window(new SampleDialog());
    Application.Current.OpenWindow(dialogWindow);
    // dialogWindow should always be on top of MainPage Window 
}

Public API Changes

Window window = new Window(page)
window.zIndex = 1 // zIndex 1 is always on top of windows with zIndex 0 

Intended Use-Case

Opening Dialogs on top of windows that cannot be hidden from its main window. but can be moved/resized as to still be able to view some part of the main window either for preview purposes of the changes or its' current state.

Implementation of modal/non modal dialogs that doesnt strict cover up contents/view of mainWindow like the community toolkit:popup or pushmodalasync.

ghost commented 1 year ago

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

zxcAsk commented 1 year ago

does anyone have a workaround for this?

mouralabank commented 1 year ago

Any updates?

mouralabank commented 1 year ago

The ability to set windows of the same application as "always on top" can be a useful feature for desktop apps in certain situations.

For example, if a user is working on a document or project in one window and needs to reference information from another window or application, setting the first window as "always on top" can allow the user to keep the relevant information visible while continuing to work in the primary window.

Similarly, if an application has multiple windows or panels that the user needs to refer to frequently, setting these windows as "always on top" can help to improve productivity and streamline the user's workflow.

jfversluis commented 1 year ago

As a workaround/implementation I think you can use this code I wrote here: https://blog.verslu.is/maui/full-screen-disable-minimize-maximize-for-net-maui-windows-apps/

Gist here: https://gist.github.com/jfversluis/d42e9a0c5c3e88869898189e29c08977#file-mainpage-cs

And use the IsAlwaysOnTop property: https://learn.microsoft.com/windows/windows-app-sdk/api/winrt/microsoft.ui.windowing.overlappedpresenter.isalwaysontop?view=windows-app-sdk-1.2

mouralabank commented 1 year ago

As a workaround/implementation I think you can use this code I wrote here: https://blog.verslu.is/maui/full-screen-disable-minimize-maximize-for-net-maui-windows-apps/

Gist here: https://gist.github.com/jfversluis/d42e9a0c5c3e88869898189e29c08977#file-mainpage-cs

And use the IsAlwaysOnTop property: https://learn.microsoft.com/windows/windows-app-sdk/api/winrt/microsoft.ui.windowing.overlappedpresenter.isalwaysontop?view=windows-app-sdk-1.2

@jfversluis Thanks for the tip, very useful! I want to give you a suggestion, I believe that videos for MAUI Desktop can be very impactful to promote and expand the community and resources! I see a lot of potential in the MAUI desktop yet to be discovered and growing!!!

lfmouradasilva commented 1 year ago

Any updates on this issue?