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

Harshithraj1871 1,516 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 App SDK
Windows App SDK
A set of Microsoft open-source libraries, frameworks, components, and tools to be used in apps to access Windows platform functionality on many versions of Windows. Previously known as Project Reunion.
752 questions
Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,523 questions
{count} votes

Accepted answer
  1. Castorix31 83,206 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 9,431 Reputation points Microsoft Vendor
    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.