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

Closed
KarthikRajaKalaimani opened this issue Dec 24, 2024 · 1 comment
Closed

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

KarthikRajaKalaimani opened this issue Dec 24, 2024 · 1 comment
Labels
bug Something isn't working

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

@karkarl
Copy link
Contributor

karkarl commented Dec 26, 2024

This is due to the Segoe UI fontset's layout. This is by design, so closing.

@karkarl karkarl closed this as not planned Won't fix, can't repro, duplicate, stale Dec 26, 2024
@karkarl karkarl removed the needs-triage Issue needs to be triaged by the area owners label Dec 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants