'Opening a new window in MAUI

In WPF the below code opens a new window.

Window abc = new Window();
abc.Show();

But for MAUI window, I cant find the show option. How to open a window in MAUI?



Solution 1:[1]

var secondWindow = new Window {
    Page = new MySecondPage {
        // ...
    }
};

Application.Current.OpenWindow(secondWindow);

https://devblogs.microsoft.com/dotnet/announcing-dotnet-maui-preview-11/

Solution 2:[2]

Try;

Navigation.PushAsync(new MainPage());

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Daniel Kelsch
Solution 2 kmp