Problem Description
When implementing a custom title bar with Avalonia on Windows 7, a compatibility issue may prevent the native title bar from being hidden, resulting in abnormal interface display:

Figure 1: Abnormal title bar display on Windows 7
Technical Analysis
Special thanks to the members of the WeChat 【Avalonia Development Discussion Group】 for their assistance:

Figure 2: Technical discussion in WeChat group
The Avalonia framework handles window decorations differently across Windows versions:
- Windows 10/11: Native support for modern window styles; custom title bars can hide the native title bar normally.
- Windows 7: Due to system compositor limitations, system decorations must be explicitly disabled.
The SystemDecorations property controls the display of window borders and title bar, with the following enumeration values:
Full: Full system decorations (default)BorderOnly: Only borders displayedNone: System decorations completely disabledResizeBorder: Only resizable borders retained
Solution
By explicitly setting the SystemDecorations property to None in the window initialization code, the native title bar can be forced to hide:
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
// Key setting: disable system decorations to support custom title bar
// Must be explicitly set on Windows 7; can be omitted on Win10+
if (OperatingSystem.IsWindows() && !OperatingSystem.IsWindowsVersionAtLeast(6, 2)) // Windows 7 and below
{
SystemDecorations = SystemDecorations.None;
}
}
}
After applying the fix, the native title bar is successfully hidden, and the custom title bar displays correctly:

Figure 3: Title bar display after fix
Also, to support AOT execution on Windows 7, do not forget to add the NuGet package:
<PackageReference Include="YY-Thunks" Version="1.1.8-Beta4" />