Я добавил следующий код в MauiProgram.cs:
Код: Выделить всё
#if WINDOWS
builder.ConfigureLifecycleEvents((events) =>
{
events.AddWindows(wndLifeCycleBuilder =>
{
wndLifeCycleBuilder.OnWindowCreated((w) =>
{
IntPtr nativeWindowHandle = WinRT.Interop.WindowNative.GetWindowHandle(w);
WindowId win32WindowsId = Win32Interop.GetWindowIdFromWindow(nativeWindowHandle);
AppWindow winuiAppWindow = AppWindow.GetFromWindowId(win32WindowsId);
if (winuiAppWindow.Presenter is OverlappedPresenter p)
{
p.IsResizable = true;
p.SetBorderAndTitleBar(false, false);
}
});
});
});
#endif

Когда я обновил код до:
Код: Выделить всё
#if WINDOWS
builder.ConfigureLifecycleEvents((events) =>
{
events.AddWindows(wndLifeCycleBuilder =>
{
wndLifeCycleBuilder.OnWindowCreated((w) =>
{
IntPtr nativeWindowHandle = WinRT.Interop.WindowNative.GetWindowHandle(w);
WindowId win32WindowsId = Win32Interop.GetWindowIdFromWindow(nativeWindowHandle);
AppWindow winuiAppWindow = AppWindow.GetFromWindowId(win32WindowsId);
if (winuiAppWindow.Presenter is OverlappedPresenter p)
{
p.IsResizable = false;
p.SetBorderAndTitleBar(false, false);
}
});
});
});
#endif
Подробнее здесь: https://stackoverflow.com/questions/787 ... dows-while