MAUI Windows Fullscreen

Little Athan 41 Reputation points
2022-08-30T17:05:49.963+00:00

I am trying to make a kiosk app for windows 10 x64 tablets and some android tablets in the future. I used this code in MauiProgram.cs:

#if WINDOWS  
  
            builder.ConfigureLifecycleEvents(events =>  
            {  
                events.AddWindows(wndLifeCycleBuilder =>  
                {  
                    wndLifeCycleBuilder.OnWindowCreated(window =>  
                    {  
                        IntPtr hWnd = WinRT.Interop.WindowNative.GetWindowHandle(window);  
                        WindowId myWndId = Win32Interop.GetWindowIdFromWindow(hWnd);  
                        var _appWindow = AppWindow.GetFromWindowId(myWndId);  
                        _appWindow.SetPresenter(AppWindowPresenterKind.FullScreen);  
                    });  
                });  
            });  
#endif  

But the result is pretty bad:

236243-screenshot-2022-08-30-200433.png

Any other ideas?

.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
3,231 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Little Athan 41 Reputation points
    2022-09-11T07:14:10.587+00:00

    I found the answer by digging around once again and by combining what I found. Here is the code for fullscreen:

    if WINDOWS

            builder.ConfigureLifecycleEvents(events =>  
            {  
                events.AddWindows(wndLifeCycleBuilder =>  
                {  
                    wndLifeCycleBuilder.OnWindowCreated(window =>  
                    {  
                        window.ExtendsContentIntoTitleBar = false;  
                        IntPtr hWnd = WinRT.Interop.WindowNative.GetWindowHandle(window);  
                        WindowId myWndId = Win32Interop.GetWindowIdFromWindow(hWnd);  
                        var _appWindow = AppWindow.GetFromWindowId(myWndId);  
                        _appWindow.SetPresenter(AppWindowPresenterKind.FullScreen);                          
                    });  
                });  
            });  
    

    endif

    1 person found this answer helpful.