I am trying to get a totally maximized Window with .NET Maui 8.0.0preview4, but an empty bar remains where the title-bar used to be.
For the example, I've ammended the Maui template by making the "Click me" button toggle the window's maximized state, with the following code inspired by Verslui's article on the topic:
private void OnCounterClicked(object sender, EventArgs e)
{
var window = Window.Handler.PlatformView as MauiWinUIWindow;
var handle = WinRT.Interop.WindowNative.GetWindowHandle(window);
var id = Microsoft.UI.Win32Interop.GetWindowIdFromWindow(handle);
var appWindow = Microsoft.UI.Windowing.AppWindow.GetFromWindowId(id);
switch (appWindow.Presenter)
{
case Microsoft.UI.Windowing.OverlappedPresenter overlappedPresenter:
if (overlappedPresenter.State == Microsoft.UI.Windowing.OverlappedPresenterState.Maximized)
{
overlappedPresenter.SetBorderAndTitleBar(true, true);
overlappedPresenter.Restore();
}
else
{
overlappedPresenter.SetBorderAndTitleBar(false, false);
overlappedPresenter.Maximize();
}
break;
}
}
I also scrapped out Shell and use the MainPage directly. Is seems like SetBorderAndTitleBar
isn't actually removing the titlebar, just the buttons.
Any ideas for how I can get a true full-screen experience would be much appreciated. Here is the repro repo for those interested. Thanks!