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

FontSize is not consistent between TextBlock and TextBox since WinAppSDK 1.6 #4724

Open
rudyhuyn opened this issue Sep 17, 2024 · 0 comments

Comments

@rudyhuyn
Copy link

rudyhuyn commented Sep 17, 2024

Describe the bug

Since the update to WinAppSDK 1.6, there is an inconsistency between TextBlock and TextBox controls regarding FontSize (and LineHeight when the FontSize is increased to match). This discrepancy results in misalignment and rendering issues, impacting the visual consistency of text across different controls.

Steps to reproduce the bug

Create a new application with WinAppSDK 1.6 and add the following XAML. Observe that the FontSize does not match.

    <StackPanel HorizontalAlignment="Center" Width="500" VerticalAlignment="Center">
        <TextBox
            x:Name="InputText"
            Height="200"
            AcceptsReturn="True"
            TextWrapping="Wrap" />

        <Grid Height="200" Margin="0,12,0,0">
            <TextBox
                x:Name="ResultTextBox"
                Padding="12"
                AcceptsReturn="True"
                FontSize="13"
                Foreground="#80ff0000"
                Text="{x:Bind InputText.Text, Mode=OneWay}"
                TextWrapping="Wrap" />
            <TextBlock
                x:Name="ResultTextBlock"
                Padding="13"
                FontSize="13"
                Foreground="#800000ff"
                Text="{x:Bind InputText.Text, Mode=OneWay}"
                TextWrapping="Wrap" />
        </Grid>
    </StackPanel>

Expected behavior

FontSize of TextBlock and TextBlock should be consistent

Screenshots

Red: TextBox
Blue: TextBlock

WinAppSDK 1.5:
image

WinAppSDK 1.6:
image

NuGet package version

Windows App SDK 1.6.0: 1.6.240829007

Packaging type

Packaged (MSIX), Unpackaged

Windows version

Insider Build (xxxxx)

IDE

Visual Studio 2022

Additional context

No response

@rudyhuyn rudyhuyn changed the title FontSize and LineHeight are not consistent between TextBlock and TextBox since WinAppSDK 1.6 FontSize is not consistent between TextBlock and TextBox since WinAppSDK 1.6 Sep 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant