TitleBar.Title Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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
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.