Share via


Window.Title Property

Definition

Gets or sets a string used for the window title.

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 = window.title;
window.title = string;
Public Property Title As String

Property Value

String

Platform::String

winrt::hstring

The string used for the window title.

Examples

This example shows how to set the Title in code.

public MainWindow()
{
    InitializeComponent();
    Title = "App title";
}

A XAML app has a display name that's set in the Package.appxmanifest file. You can get this value and use it to set the Title property like this:

Title = AppInfo.Current.DisplayInfo.DisplayName;

Note

In Windows App SDK 1.3.0 and earlier, Title shows in the XAML IntelliSense for Window, but setting it in XAML causes an error. Set this property in code instead. In Windows App SDK 1.3.1 and later, you can set this property in XAML.

<Window
    ...
    Title="App title">
    ...
</Window>

Remarks

For more information, see Title bar customization

By default, the title bar shows the app type as the window title (for example, "WinUI Desktop"). You should update the window title to show a meaningful display name for your app.

To replace the title with custom text, set the Window.Title property to a text value, as shown in the Examples.

In addition to the title bar, this string is used in other system UI such as the application switcher (Alt-Tab).

This is a wrapper for SetWindowText.

If ExtendsContentIntoTitleBar is set to true, this value is not displayed by the title bar.

Applies to

See also