I'm building a WinUI 3 desktop application with a custom TitleBar. I've applied FlowDirection="RightToLeft" to the main grid in my MainWindow.xaml, but the caption buttons (minimize, maximize, close) and the title alignment remain in left-to-right layout.
<Window
x:Class="YourNamespace.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:YourNamespace">
<Window.SystemBackdrop>
<MicaBackdrop />
</Window.SystemBackdrop>
<Grid x:Name="MainGrid" RowDefinitions="auto,*">
<TitleBar
Title="Custom Title Bar"
IsBackButtonEnabled="True"
IsBackButtonVisible="True"
Subtitle="Beta">
<TitleBar.RightHeader>
<PersonPicture Height="25" Initials="JD" />
</TitleBar.RightHeader>
</TitleBar>
<StackPanel Grid.Row="1">
<Button Content="Click" />
</StackPanel>
</Grid>
</Window>
Code behind file:
public sealed partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
MainGrid.FlowDirection = FlowDirection.RightToLeft;
ExtendsContentIntoTitleBar = true;
this.AppWindow.TitleBar.IconShowOptions = Microsoft.UI.Windowing.IconShowOptions.ShowIconAndSystemMenu;
this.AppWindow.TitleBar.ButtonBackgroundColor = Microsoft.UI.Colors.Transparent;
this.AppWindow.TitleBar.PreferredHeightOption = Microsoft.UI.Windowing.TitleBarHeightOption.Tall;
}
}
What I expect:
The custom TitleBar content and caption buttons should appear mirrored, with caption buttons on the left side when FlowDirection.RightToLeft is applied.
What happens instead: Only the internal elements (MainGrid) respect RightToLeft.
The caption buttons and title remain in LeftToRight layout.
Question: How can I force the caption buttons and title bar in a WinUI 3 custom title bar to follow FlowDirection.RightToLeft? Is this a known limitation or am I missing a specific setting?
Thanks!