WinUI3 : How to remove Min Max Close button with tittle bar customization

Harshithraj1871 1,686 Reputation points
2023-03-17T05:23:11.2133333+00:00

Hi,

I am working on the WinUI3 desktop application with C++. I discovered how windows significantly allow us to customize the title bar in this link. But it also said, it will reserve the Top Right/Top Left corner for the Min, Max, and Close buttons which windows will handle.

How can we get control over the Min, Max, and Close buttons, suppose I want to show only the Close button, or I want to use my custom button for Min, Max, and Close. How to get control over the Min, Max, and Close buttons when we use Window Title customization?

I tried using Win32 APIs as SetWindowLongPtr(windowhandle, GWL_STYLE, WS_POPUP); , Even with this, I was not able to remove the Min, Max, or Close buttons after setting WinUIWindow.ExtendsContentIntoTitleBar = true;

It would be great if you could help me remove Min, Max, and Close buttons when I use title bar customization.

Thank You

Windows development | Windows App SDK
Windows development | Windows API - Win32
{count} votes

Accepted answer
  1. Castorix31 90,686 Reputation points
    2023-03-19T21:02:48.05+00:00

    You can see the sample I had uploaded where I use SetBorderAndTitleBar, with transparency (layered window)

    and PointerMoved and others to move the window :

    https://github.com/castorix/WinUI3_SwapChainPanel_Layered

    WinUI3_Layered

    2 people found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. Jeanine Zhang-MSFT 11,356 Reputation points Microsoft External Staff
    2023-03-17T06:37:24.9866667+00:00

    Hello,

    Welcome to Microsoft Q&A!

    As far as I'm concerned, you couldn't remove Min Max Close button with tittle bar customization.

    According to the Doc: Title bar customization

    When you opt-in to full title bar customization, your app's client area is extended to cover the entire window, including the title bar area. You are responsible for drawing and input-handling for the entire window except the caption buttons, which are still provided by the window.

    That area is a reserved area. If you want to hide the buttons, you could try to extend your content into the title bar area.

    Thank you.

    Jeanine


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.