WindowsAppSDK
WindowsAppSDK copied to clipboard
IsMaximizable Ignored When Content Extends into Title Bar
Describe the bug
AppWindow::Presenter::IsMaximizable is ignored when MainWindow::ExtendsContentIntoTitleBar(true);
Steps to reproduce the bug
- New Blank WinUI 3 Project
- MainWindow::ExtendsContentIntoTitleBar(true)
- Get the AppWindow using <winrt/Microsoft.UI.Interop.h>
- Get the AppWindow::Presenter
- Set Presenter::IsMaximizable(false);
Expected behavior
The maximize button should be disabled the same as when the content is not extended into the title bar.
Screenshots
See above
NuGet package version
Windows App SDK 1.2.4: 1.2.230217.4
Packaging type
Packaged (MSIX)
Windows version
Windows 11 version 22H2 (22621, 2022 Update)
IDE
Visual Studio 2022
Additional context
No response
Could you share your code to reproduce the bug?
Yep. Give me a few mins. I'll push a branch and link it here.
Here you go.
https://github.com/jamespack/IsMaximizableBug
I cannot resolve the bug, but I will share information related to AppWindow. https://github.com/microsoft/microsoft-ui-xaml/issues/7628 https://github.com/microsoft/microsoft-ui-xaml/issues/8201
Thanks for the material. I was able to get it working by setting an empty custom titlebar and setting its ExtendsContentIntoTitleBar property to true. Thats a hack though. Id still say this is a bug unless the intention is to remove this api at some point in favor of the AppWIndow api.
With a hopefully improved AppWindow API :)
Unfortunately, there are 2 different "ExtendsContentIntoTitleBar" right now:
- WinUI 3's custom title bar in Microsoft.UI.Xaml.Window class
- AppWindow's custom title bar in Microsoft.UI.Windowing.AppWindowTitleBar
Since the IsMaximizable property is set on an AppWindow presenter, you would need to use appWindow.TitleBar().ExtendsContentIntoTitleBar(true); for it to function properly.
The entire window/title bar api is kind of messy. I know it's still relatively early. So hoping that improved over time. Over all super excited about Windows Apps and the future for windows devs!
I hit the same and had a user report this in WinUIEx as well. The IsMinimizable and IsMaximixable does gray out the buttons, but they are still fully interactive.
The proposed workaround by @peterjtan had no effect for me.
Unfortunately, there are 2 different "ExtendsContentIntoTitleBar" right now:
- WinUI 3's custom title bar in Microsoft.UI.Xaml.Window class
- AppWindow's custom title bar in Microsoft.UI.Windowing.AppWindowTitleBar
Since the
IsMaximizableproperty is set on an AppWindow presenter, you would need to useappWindow.TitleBar().ExtendsContentIntoTitleBar(true);for it to function properly.
Thanks for saving my life.
Closing this as duplicate. microsoft/microsoft-ui-xaml#8666 looks like a direct duplicate which we have an internal tracking issue for.