microsoft / microsoft/microsoft-ui-xaml
TextBlock can't be right aligned
- Dominant language
- C++
- Stars
- 8.4k
- Forks
- 942
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 105
Description
### Describe the bug
I'm trying to make a `TextBlock` be right aligned, where the text is always pinned to the right edge of the `TextBlock` and as the `TextBlock` is resized, trimming of the `TextBlock` occurs on the left side.
It sounds like `FlowDirection` of `RightToLeft` should be the property to set, along with setting `TextReadingOrder` to `UseFlowDirection` but this doesn't seem to work. The `TextBlock` still behaves the same way
### Steps to reproduce the bug
1. Create a blank C# app
2. Add this `TextBlock` to the `MainWindow.xaml`:
```
```
### Expected behavior
The end of the TextBlock is visible "stick to the right side and be truncated at the left"
### Screenshots

### NuGet package version
WinUI 3 - Windows App SDK 1.6.3: 1.6.241114003
### Windows version
Windows 11 (24H2): Build 26100
### Additional context
If there is a different way to accomplish this not through these APIs I'd be happy to do this
Contributor guide
Research direction
Start with the TextBlock reproduction in MainWindow.xaml from the issue, using the stated TextAlignment, TextReadingOrder, FlowDirection, Width, and long text. Confirm how resizing and truncation behave in the blank C# app, then trace the relevant WinUI TextBlock behavior. Done means the expected text remains pinned to the right edge and is truncated on the left.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- desktop, frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100