Share via


TitleBar.Title Property

Definition

Gets or sets the title text to display in the title bar.

public:
 property Platform::String ^ Title { Platform::String ^ get(); void set(Platform::String ^ value); };
winrt::hstring Title();

void Title(winrt::hstring value);
public string Title { get; set; }
var string = titleBar.title;
titleBar.title = string;
Public Property Title As String

Property Value

String

Platform::String

winrt::hstring

The title text to display in the title bar. The default is an empty string.

Examples

This example shows how to bind the Title property to the app's DisplayName.

xmlns:appmodel="using:Windows.ApplicationModel"

<TitleBar Title="{x:Bind appmodel:AppInfo.Current.DisplayInfo.DisplayName}"/>

You can also set it in code.

using Windows.ApplicationModel;

TitleBar titleBar = new TitleBar();
titleBar.Title = AppInfo.Current.DisplayInfo.DisplayName;

This example shows how to set the Title property to a literal string.

<TitleBar Title="My App"/>
TitleBar titleBar = new TitleBar();
titleBar.Title = "My App";

Remarks

The title is typically used to show the app's display name.

When the TitleBar is in compact display mode, the Title and Subtitle elements are not shown.

Applies to