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

The TextBlock text is not centered in Windows 11. #10256

Open
KarthikRajaKalaimani opened this issue Dec 24, 2024 · 0 comments
Open

The TextBlock text is not centered in Windows 11. #10256

KarthikRajaKalaimani opened this issue Dec 24, 2024 · 0 comments
Labels
bug Something isn't working needs-triage Issue needs to be triaged by the area owners

Comments

@KarthikRajaKalaimani
Copy link

KarthikRajaKalaimani commented Dec 24, 2024

Describe the bug

When adding a TextBlock with both HorizontalAlignment and VerticalAlignment set to "Center" within a Grid, the text appears correctly centered in Windows 10 but is misaligned in Windows 11. Please refer to the screenshot below for comparison.

Windows 11 :
Image

Windows 10:
Image

Steps to reproduce the bug

  1. Run the below code in MainWindow.xaml
 <Grid Height="40" Width="164" Background="LightGray">
     <Grid Background="Orange" Height="20" HorizontalAlignment="Center" VerticalAlignment="Center">
     <TextBlock Text="Stop responding" x:Name="label" 
            Height="20"
            HorizontalAlignment="Center"
            VerticalAlignment="Center"
             />
     </Grid>
 </Grid> 

Expected behavior

The text should be horizontally and vertically centered.

Screenshots

No response

NuGet package version

WinUI 3 - Windows App SDK 1.6.3: 1.6.241114003

Windows version

Windows 11 (23H2): Build 22631

Additional context

No response

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