Skip to content

Commit a57f2d4

Browse files
authored
docs(.NET10/Windows): Document enabling/disabling minimize/maximize window buttons; update ms.date (#2992)
1 parent 44262d9 commit a57f2d4

File tree

1 file changed

+35
-1
lines changed

1 file changed

+35
-1
lines changed

docs/user-interface/controls/window.md

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "Window"
33
description: "Learn how to use the .NET MAUI Window class to create, configure, show, and manage multi-window apps."
4-
ms.date: 01/17/2025
4+
ms.date: 08/19/2025
55
---
66

77
# Window
@@ -352,3 +352,37 @@ public partial class App : Application
352352
```
353353

354354
Provided that the <xref:Microsoft.Maui.Controls.IWindowCreator> interface and its concrete type have been registered with the app's service container, and that the <xref:Microsoft.Maui.Controls.Application.MainPage> property of the <xref:Microsoft.Maui.Controls.Application> class isn't set, your registered type will be used to create the <xref:Microsoft.Maui.Controls.Window>.
355+
356+
::: moniker range=">=net-maui-10.0"
357+
358+
## Enable or disable minimize and maximize buttons on Windows
359+
360+
On Windows, you can enable or disable the minimize and maximize buttons on a window. This can be accomplished by retrieving the underlying WinUI window and adjusting its presenter properties.
361+
362+
The following example disables both the minimize and maximize buttons:
363+
364+
```csharp
365+
#if WINDOWS
366+
using Microsoft.Maui.Platform; // MauiWinUIWindow
367+
using Microsoft.UI.Windowing; // AppWindow, OverlappedPresenter
368+
369+
public static void ConfigureWindowButtons(Window window)
370+
{
371+
var nativeWindow = (MauiWinUIWindow)window.Handler.PlatformView;
372+
var appWindow = nativeWindow.AppWindow;
373+
374+
if (appWindow.Presenter is OverlappedPresenter presenter)
375+
{
376+
presenter.IsMinimizable = false;
377+
presenter.IsMaximizable = false;
378+
}
379+
}
380+
#endif
381+
```
382+
383+
Call `ConfigureWindowButtons` during app startup (for example, after creating the `Window` in `CreateWindow`) or when showing a secondary window.
384+
385+
> [!NOTE]
386+
> These properties only apply on Windows desktop. Other platforms ignore this code path. To re-enable buttons, set `IsMinimizable` and `IsMaximizable` back to `true`.
387+
388+
::: moniker-end

0 commit comments

Comments
 (0)