Windows Title Bar in .NET MAUI (Win UI 3)

J0nathan550 20 Reputation points

Hello, I have a question that I always wanted to ask related to Windows Title bar (i'm talking about this one):User's image

When .NET 8 released, I saw that it switched the WinUI to 3 version, which support Title Bar customization.

My question is how to modify this Title Bar?

How to change the color of title bar (to no be accent from user for example I want this title bar to be black.)

How to add icon?

How to add additional items like in other Win11 apps?User's image

How with WinUI 3 assign to your visual Myca style or Acryl?

I hope I will get answer onto how modify title bar since this is only topic that bothers me.

Windows 10
Windows 10
A Microsoft operating system that runs on personal computers and tablets.
10,949 questions
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
3,061 questions
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,484 questions
Windows 11
Windows 11
A Microsoft operating system designed for productivity, creativity, and ease of use.
8,625 questions
0 comments No comments
{count} votes

Accepted answer
  1. Leon Lu (Shanghai Wicresoft Co,.Ltd.) 70,646 Reputation points Microsoft Vendor


    Avoid posting multiple questions in a single thread in Q&A

    Let's focus on the first issue, you can open new threads for other issues.

    How to change the color of title bar (to no be accent from user for example I want this title bar to be black.)

    You can get the titlebar in the following ConfigureLifecycleEvents, then set the background color to black for titlebar, three button's background and the inactive status.

        public static class MauiProgram
            public static MauiApp CreateMauiApp()
                var builder = MauiApp.CreateBuilder();
                   .ConfigureLifecycleEvents(events =>
    #if WINDOWS
                                  events.AddWindows(windowsLifecycleBuilder =>
                                      windowsLifecycleBuilder.OnWindowCreated(window =>
                                          var handle = WinRT.Interop.WindowNative.GetWindowHandle(window);
                                          var id = Microsoft.UI.Win32Interop.GetWindowIdFromWindow(handle);
                                          var appWindow = Microsoft.UI.Windowing.AppWindow.GetFromWindowId(id);
                                          var titleBar = appWindow.TitleBar;                                
                                          titleBar.BackgroundColor = Colors.Black.ToWindowsColor();
                                          titleBar.ButtonBackgroundColor = Colors.Black.ToWindowsColor();                                             
                                          titleBar.InactiveBackgroundColor = Colors.Black.ToWindowsColor();    
                                          titleBar.ButtonInactiveBackgroundColor = Colors.Black.ToWindowsColor();

    Best Regards,

    Leon Lu

    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.

0 additional answers

Sort by: Most helpful