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

I will be needing a modal dialog to be on top of another modal dialog as well. like how Save Dialogs are on top of lets say the notepad app and the the prompt "Do you want to replace it?" dialog is on top of the save dialog.

I have tried Community toolkit popup. but it can only have 1 popup per window. PushModalAsync is not a desirable outcome as it is still preferred to have separated dialogs.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
zxcAsk
  • 11
  • 2
  • Might have to set a property on the specific Platform's (WinUI-3) Window. Search for example of custom handler for Maui Window class. – ToolmakerSteve Nov 29 '22 at 21:14
  • See the code in [this question](https://stackoverflow.com/q/74302579/199364). Inside `#if WINDOWS`. `var nativeWindow` is the Windows platform's Window. Maybe can do inline like shown there. If not, then see [my answer for ContentView custom handler / ALTERNATIVE 1 - MyContentViewHandler](https://stackoverflow.com/a/72327136/199364). I've never tried for `Window`, but hopefully it looks similar. – ToolmakerSteve Dec 05 '22 at 22:45

1 Answers1

0

According to the official docuement about the Windows in .Net Maui, the X and Y property of the Windows can set the position of it. But I tried to use the two properties, they didn't work.

Here is my Code:

Window window = new Window(new NewPage1());
window.MaximumHeight = 200;
window.MaximumWidth = 400;
var width = App.Current.Windows.First().Width;
var height = App.Current.Windows.First().Height;
window.X = width/2;
window.Y = height/2;

You can create a project with .net 7(These propertoes doesn't exist in the .net 6) to test. In addition, you can report it to the maui on the github.

Liyun Zhang - MSFT
  • 8,271
  • 1
  • 2
  • 14
  • my understanding is that x and y are for left and right up and down. but currently doesnt seem to have forward and back or well z-index. Posted on Maui Github - https://github.com/dotnet/maui/issues/11778 issue has been set to their backlog – zxcAsk Dec 05 '22 at 08:44