TitleBar Functional Spec
WinUI: a modern UI framework with a rich set of controls and styles to build dynamic and high-performing Windows applications.
TitleBar Functional Spec
Control category: Basic Input
Background
Motivations for the TitleBar control include:
- Achieve parity with Fluent Windows Visual Design Library.
- Bridge the gap between Shell / Win32 title bar and a fully custom Xaml titlebar.
- Simplify the developer experience for implementing the modern title bar.
Description
The title bar is a fundamental component of a Windows app’s user interface. Here are its key features and functionalities:
- Display Information:
- The title bar prominently displays the name of the app or document currently open. Users can quickly identify which app they are interacting with.
- Additionally, the title bar may include other relevant information, such as the document title or the current state (e.g., “Editing,” “Viewing,” etc.).
- Window Controls:
- Minimize Button: Clicking the minimize button (usually represented by an underscore icon) reduces the app window to the taskbar or system tray.
- Maximize Button: Clicking the maximize button (usually represented by a square icon) expands the app window to fill the screen.
- Close Button: Clicking the close button (usually represented by an “X” icon) closes the app window.
- Drag and Move:
- Users can click and drag the title bar to move the app window around the screen. This allows them to position the window wherever they prefer.
- Theming and Integration:
- The title bar can be customized to match the app’s visual style using Mica theming.
- It also integrates with other WinUI controls, such as NavigationView, AutoSuggestBox, and PersonPicture, providing a cohesive user experience.
Is this the right control?
A title bar is a core component of a Windows app, and the shell version of the title bar is shipped with the basic WinUI app template by default.
Use the WinUI TitleBar when you want further customizations such as subtitles, Mica theming, and integrations with WinUI Controls.
Note: WinUI TitleBar does not handle Caption Buttons - it simply allocates space where the caption buttons appear, depending on RTL or LTR settings. Caption Buttons and its customizations are handled by the AppWindow TitleBar.
Sample scenarios
#Scenario: Default TitleBar

XAML
C#
Note: TitleBar currently needs to be set explicitly in the grid.row and referenced by Window in codebehind as shown above. Improvements to Window are being considered to avoid this extra grid layout and codebehind. Please see Appendix of Functional Spec.
#Scenario: TitleBar with WinUI Controls Integration
TitleBar with common WinUI Controls: AutoSuggestBox, PersonPicture, AppBarButton.

XAML
#Scenario: TitleBar with NavigationView L-Pattern Integration
Titlebar and NavigationView in an L-Pattern.

TitleBar and NavigationView is in Minimal DisplayMode.
Note that TitleBar IconSource is collapsed in minimal mode.

XAML
Note: Should the NavView resources be the default to avoid needing the extra code? This will be a question of what pattern will be shipped in WinUI Templates by default.
C#
Note: How can we avoid this extra code-behind?
API Pages
#TitleBar class
Represents a control that provides the title and system buttons for a window or application. It typically appears at the top of the window and includes core functionalities such as drag, minimize, maximize, and close buttons.
Namespace: Microsoft.UI.Xaml.Controls
#TitleBar.ContentBefore property
Gets and sets elements within the TitleBar's ContentBefore column.
#Property Value
Represents the ContentBefore content property of the TitleBar control which can be populated in both XAML markup and code. The default is null.
#Remarks
The content property of ContentBefore can only be set once. Elements are left aligned by default.
If IsBackButtonVisible or IsPaneToggleButtonVisisble is true, custom content set in the ContentBefore property
will automatically be appended to the ContentBefore column in TitleBar layout.
If the property is not null, TitleBar automatically configures its height to TitleBarExpandedHeight in codebehind. See ThemeResources section for further details.
#TitleBar.Title property
Gets or sets the Title text to be displayed on the TitleBar.
#Property Value
Represents the title string to be displayed on the TitleBar. The default is null.
#Remarks
If TitleBar is in minimal display mode, Title textbox will automatically be collapsed. If Title string is empty, Title textbox will be collapsed.
#TitleBar.Subtitle property
Gets or sets the Subtitle text to be displayed on the TitleBar. This is generally used for versioning, such as "Preview", "Beta", etc.
#Property Value
Represents the subtitle string to be displayed on the TitleBar. The default is null.
#Remarks
If TitleBar is in minimal display mode, Subtitle textbox will automatically be collapsed.
If Subtitle string is empty, Subtitle textbox will be collapsed.
#TitleBar.IconSource property
Gets or sets the TitleBar's icon.
#Property Value
Represents the icon associated with the TitleBar. The default is null.
#TitleBar.Content property
Gets and sets elements within the TitleBar's Content column.
#Property Value
Represents the Content property of the TitleBar control which can be populated in both XAML markup and code.
This is typically used to populate controls such as AutoSuggestBox. The default is null.
#Remarks
The content property of Content can only be set once. Elements are center aligned by default.
If the property is not null, TitleBar automatically configures its height to TitleBarExpandedHeight in codebehind. See ThemeResources section for further details.
#TitleBar.ContentAfter property
Gets and sets elements within the TitleBar's ContentAfter column.
#Property Value
Represents the ContentAfter property of the TitleBar control which can be populated in both XAML markup and code.
This is typically used to populate controls such as PersonPicture and the "More" AppBarButton. The default is null.
#Remarks
The content property of ContentAfter can only be set once. Elements are right aligned by default.
If the property is not null, TitleBar automatically configures its height to TitleBarExpandedHeight in codebehind. See ThemeResources section for further details.
#TitleBar.IsBackButtonVisible property
Gets and sets TitleBar's BackButton visiblity.
#Property Value
Represents the visiblity of TitleBar's BackButton. The default is false.
#TitleBar.IsBackButtonEnabled property
Gets and sets BackButton's IsEnabled property.
#Property Value
Represents the IsEnabled property of TitleBar's BackButton. The default is true.
#Remarks
This property is typically bound to an accompanying NavFrame's CanGoBack property:
IsBackButtonEnabled="{x:Bind NavFrame.CanGoBack}"
#TitleBar.IsPaneToggleButtonVisible property
Gets and sets TitleBar's PaneToggleButton visiblity.
#Property Value
Represents the visiblity of TitleBar's PaneToggleButton. The default is false.
#Remarks
TitleBar's PaneToggleButton is only used with NavigationView and when NavigationView is in Minimal DisplayMode.
In other display mode scenarios, the PaneToggleButton is owned and handled by NavigationView.
#TitleBar.BackRequested event
Occurs whenever BackButton is clicked.
C#
#Remark
This event is raised when internal BackButton raises a Click event.
#TitleBar.PaneToggleRequested event
Occurs whenever PaneToggleButton is clicked.
C#
#Remark
This event is raised when internal PaneToggleButton raises a Click event.
#TitleBarTemplateSettings Class
#TitleBarAutomationPeer Class
Exposes TitleBar types to Microsoft UI Automation.
Namespace: Microsoft.UI.Xaml.Automation.Peers
TitleBarAutomationPeer implements ...
API Details
ThemeResources
This section does not list all of the ThemeResources associated with TitleBar. Only ThemeResources of note that require highlight or further explanation.
TitleBar currently overwrites the resources on theme changes in codebehind. This can be removed once the theme change feature is shipped for AppWindow.
There is no TitleBar.Height property. The height for TitleBar is configured in codebehind depending on whether there
is content present in the ContentBefore, Content, and ContentAfter content areas. TitleBar's height is set to TitleBarCompactHeight if no elements are present in the mentioned content areas, and TitleBarExpandedHeight if
elements are present. As the content areas are empty by default, the default height for TitleBar is
TitleBarCompactHeight.
Figma link
Appendix
Reference:
Quick Actions
Details
- Type
- Functional Spec
- Author
- microsoft
- Slug
- microsoft/titlebar-titlebar-functional-spec
