Custom TitleBar is not work well in RTL
See original GitHub issueDescribe the bug
Custom title bar doesn’t work well in Right To Left layout I used the code from the documentation
Below you can see the reaction of the title bar when layout is right to left with different methods:
Windows.Globalization.ApplicationLanguages.PrimaryLanguageOverride = "fa-IR";
As you can see, the title does not stick to the right side and is as far as the CaptionButtons
2.FlowDirection="RightToLeft"
As you can see, CaptionButtons and title are placed in each other
- using NativeMethods
WS_EX_LAYOUTRTL
andSetWindowLong(hWnd, GWL_EXSTYLE, exstyle | WS_EX_LAYOUTRTL)
The drag regions are not correct and the title is still on the left side
- using NativeMethods
WS_EX_LAYOUTRTL
andSetWindowLong(hWnd, GWL_EXSTYLE, exstyle | WS_EX_LAYOUTRTL)
andFlowDirection="RightToLeft"
Steps to reproduce the bug
create a winui 3 project + full titlebar customization change your app to RTL layout with 3 methods
Expected behavior
Caption buttons should be on the left side, title and icon should be on the right side, Also, the title and icon should be placed on the right without spaces [see first image]
Screenshots
No response
NuGet package version
Windows App SDK 1.3.2: 1.3.230602002
Packaging type
Packaged (MSIX), Unpackaged
Windows version
Windows 11 version 22H2 (22621, 2022 Update)
IDE
Visual Studio 2022
Additional context
No response
Issue Analytics
- State:
- Created 2 months ago
- Comments:8 (5 by maintainers)
@pratikone i tested with 1.4-preview1 First of all, there is no right-to-left functionality with C# code! In version 1.3, the app can be set to right to left with the following code:
Windows.Globalization.ApplicationLanguages.PrimaryLanguageOverride = "fa-IR";
But in 1.4 no code works except p/invoke Second, I changed app layout to right to left with P/invoke and issue is still exists@pratikone I gave it a test in my C# project and it no longer mismatches the buttons visible location from their hitboxes, however it behaves as if it were LTR. Is there a way to set the TitleBar layout/flow direction in the C# API?
Also, in 1.2 when you didn’t enable
ExtendsContentIntoTitleBar
the titlebar would match the system language’s flow direction. However, in 1.4 that behavior has changed and it will always be LTR.