A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
Hi @Bronsk1y , thank you for confirming that using the .NET MAUI TitleBar resolved the issue.
To provide some additional context on the solution, it can be incorporated directly into your existing CreateWindow override in App.xaml.cs:
protected override Window CreateWindow(IActivationState? activationState)
{
return new Window(new MainPage())
{
Title = "NuPack",
TitleBar = new TitleBar
{
Title = "NuPack",
Icon = "titlebar_icon.png"
}
};
}
In this setup, titlebar_icon.png can be placed in Resources/Images, which your project already includes as MauiImage resources:
<MauiImage Include="Resources\Images\*" />
The reason this resolves the issue is that Window.TitleBar is the .NET MAUI API for assigning a title bar to a Window, while TitleBar.Icon specifically represents the optional icon displayed in that title bar. The recommended size for the title bar icon is 16×16 pixels.
With this approach, retrieving the native Windows AppWindow and setting its icon separately is unnecessary for this purpose. The previous Windows-specific handling using AppWindow.SetIcon(), SetTitleBar(), and ExtendsContentIntoTitleBar would only need to remain if it is required for other title bar customization.
It is also worth distinguishing TitleBar.Icon from the following setting in your project:
<MauiIcon Include="Resources\AppIcon\appicon.svg" />
MauiIcon defines the application icon used to generate platform-specific app icon resources, whereas TitleBar.Icon controls the icon displayed in the .NET MAUI TitleBar.
For more information, please refer to the .NET MAUI TitleBar documentation.
If you found my explanation was helpful or informative to the solution, I would greatly appreciate it if you could follow this guide so others with the same issue can benefit as well. Thank you.