question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Question: How to Maximize, Minimize, Restore WinUI window from code?

See original GitHub issue

Is there an API that manipulates a WinUI window size/state from code?

I have used the TitleBar API’s that I am aware of to set a custom TitleBar

            ExtendsContentIntoTitleBar = true;
            SetTitleBar(myControl);

While this works to set the TitleBar, the Minimize/Maximize/Close buttons are now unresponsive. I would like to overlay my own buttons to restore the broken behavior. Or, if there is a better example for how to set the custom TitleBar that does not disable the main window buttons, that would be a great solution as well. I posted this on StackOverflow, but have not had any responses.

This is for WinUI 3 (Project Reunion 0.5), Win32 Desktop

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
marb2000commented, Apr 30, 2021

@omnilogix The custom Title bar has a couple of bugs that depending on the XAML layout caption buttons aren’t rendered on the top of the visual tree. We have bug fixes ready for 0.8 GA.
About Maximize, Minimize, and Restore WinUI window from code, you can find some samples at DesktopWindow that shows you how you can achieve it using Win32 APIs. These window functionalities will be added post v1, per the current engineering plan.

0reactions
andrewleadercommented, Apr 6, 2021

Thanks omnilogix for bringing this up, really sorry you didn’t get a timely response!

Ping @MikeHillberg, question for you above.

Read more comments on GitHub >

github_iconTop Results From Across the Web

c# - How to Maximize, Minimize, Restore WinUI window ...
I'm creating a demo app using WinUI 3 prerelease 0.5 (project reunion). I would like to maximize, minimize, and restore the window state...
Read more >
How to Maximize, Minimize, Restore WinUI window from code-C
Here is my implementation based on the PInvoke.User32 nuget package. Version using Window parameter public void MaximizeWindow(Window window) { var ...
Read more >
Full-screen, disable minimize/maximize for .NET MAUI ...
In this post we will learn how to make your .NET MAUI Windows app fullscreen or disable the maximize and minimize button on...
Read more >
ShowWindow function (winuser.h) - Win32 apps
Activates and displays a window. If the window is minimized, maximized, or arranged, the system restores it to its original size and position....
Read more >
WinUI 3 for Desktop: minimize the App : r/dotnet
Is there already a native command to minimize the app without using ... need some code to get your AppWindow from the current...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found