Skip to content

TextBlock can't be right aligned #10316

Open
@stevenbrix

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:
        <TextBlock Text="Hi there my name is Joe and this is long text which should stick to the right side and be truncated at the left" Width="300" TextAlignment="Right" TextReadingOrder="UseFlowDirection" FlowDirection="RightToLeft"/>

Expected behavior

The end of the TextBlock is visible "stick to the right side and be truncated at the left"

Screenshots

Image

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

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingneeds-triageIssue needs to be triaged by the area owners

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions