Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TextBlock can't be right aligned #10316

Open
stevenbrix opened this issue Jan 25, 2025 · 0 comments
Open

TextBlock can't be right aligned #10316

stevenbrix opened this issue Jan 25, 2025 · 0 comments
Labels
bug Something isn't working needs-triage Issue needs to be triaged by the area owners

Comments

@stevenbrix
Copy link
Contributor

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

@stevenbrix stevenbrix added the bug Something isn't working label Jan 25, 2025
@microsoft-github-policy-service microsoft-github-policy-service bot added the needs-triage Issue needs to be triaged by the area owners label Jan 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs-triage Issue needs to be triaged by the area owners
Projects
None yet
Development

No branches or pull requests

1 participant