How to set height or extend hidden titlebar on MacCatalyst in .NET MAUI 9

Dejan Petrovic 0 Reputation points
2025-01-28T10:35:45.5233333+00:00

Hi, I have a question regarding titlebar on MacCatalyst.

My app scenario is to expand the window content over the titlebar on macOS.

I solved that by hiding the titlebar and setting a negative margin in xaml:

    private void windowHandlerChanged(object sender, EventArgs e)
    {
        var win = sender as Microsoft.Maui.Controls.Window;
        try
        {
            var uiWin = win.Handler.PlatformView as UIWindow;
            if (uiWin != null)
            {
                uiWin.WindowScene.Titlebar.TitleVisibility = UITitlebarTitleVisibility.Hidden;
            }
        }
        catch
        {
        }
    }

Current:
Titlebar_Current

The next step is to somehow set the height of the titlebar or use some other method to get a more macOS standard appearance of the application in terms of the position of the window buttons.

Desired:
Titlebar_Desired

I found that this can be achieved using the NSWindow object, but it is not available in NET MAUI.

Also, currently the MAUI TitleBar implementation only exists for Windows.

And that's where I got stuck and I need help.

.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
3,877 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Yonglun Liu (Shanghai Wicresoft Co,.Ltd.) 47,926 Reputation points Microsoft Vendor
    2025-01-29T05:35:50.5633333+00:00

    Hello,

    Thanks for your feedback.

    Currently, the TitleBar in Maui only supports the Windows platform, which means that the customization of the TitleBar control on the Mac has not yet been integrated into the Maui framework.

    TitleBar is only available on Windows. Mac Catalyst support will be added in a future release.

    Therefore, the function of customizing TitleBar on Mac platform needs to wait for Maui to officially support it. Please continue to pay attention to the official developments of Maui to avoid missing this feature update.

    Best Regards,

    Alec Liu.


    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.