question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Custom TitleBar is not work well in RTL

See original GitHub issue

Describe 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:

  1. 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

aa

2.FlowDirection="RightToLeft"

As you can see, CaptionButtons and title are placed in each other

bb

  1. using NativeMethods WS_EX_LAYOUTRTL and SetWindowLong(hWnd, GWL_EXSTYLE, exstyle | WS_EX_LAYOUTRTL)

The drag regions are not correct and the title is still on the left side

cc

  1. using NativeMethods WS_EX_LAYOUTRTL and SetWindowLong(hWnd, GWL_EXSTYLE, exstyle | WS_EX_LAYOUTRTL) and FlowDirection="RightToLeft"

01

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:open
  • Created 2 months ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
ghost1372commented, Jul 21, 2023

@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

1reaction
Avid29commented, Jul 21, 2023

@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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Custom TitleBar is not working in RTL #2518
Describe the bug. i used Custom titlebar from here https://docs.microsoft.com/en-us/windows/apps/develop/title-bar?tabs=wasdk#platform-options.
Read more >
JavaFX title bar RTL not supported?
I cant seem to find a way of making the title bar of my window be RTL. I can make the inner nodes...
Read more >
Posts title text direction – some RTL and some LTR ...
Hello,. I am very new to WordPress. I am trying to build a website in which users can post both in english and...
Read more >
LTR and RTL in post title problem - Support
SOLVED for yoast. Just customized the SEO title and it is OK now. The only remaining issue is that the SEO title is...
Read more >
Right-to-left Styling
It works but is not ideal. Using a pseudo-element would be better because it will flip based on the page's direction. .c-brand:after ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found