'How to set window title for a MAUI Blazor App targeting Windows?

Ive created a small application from the MAUI Blazor app template in MAUI preview 10 and have it targeted and running on windows. I however wish to set the title of the application which I imagined would be done with the Title attribute in the MainPage.xaml ContentPage tag. This however does nothing when starting the application.

enter image description here



Solution 1:[1]

public partial class MainApp : Application
{
    public MainApp()
    {
        InitializeComponent();

        MainPage = new MainPage();
    }

    protected override Window CreateWindow(IActivationState activationState)
    {
        var window = base.CreateWindow(activationState);
        if (window != null)
        {
            window.Title = "YOUR WINDOW TITLE";
        }

        return window;
    }
}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Mark.Fang