内容目录
默认情况下,MAUI 全屏的时候,任务栏会被屏蔽掉。
参考解决方法:https://github.com/dotnet/maui/issues/5478
获取窗口对象:
IntPtr nativeWindowHandle = WinRT.Interop.WindowNative.GetWindowHandle(window);
WindowId win32WindowsId = Win32Interop.GetWindowIdFromWindow(nativeWindowHandle);
AppWindow winuiAppWindow = AppWindow.GetFromWindowId(win32WindowsId);
设置全屏时保留任务栏:
switch (winuiAppWindow.Presenter)
{
case OverlappedPresenter overlappedPresenter:
overlappedPresenter.SetBorderAndTitleBar(true, true);
overlappedPresenter.Maximize();
break;
}
主要是 SetBorderAndTitleBar。
文章评论