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.TextAlignment broken after upgrading from 11.1.4 to 11.2.0 #17450

Open
Tyrrrz opened this issue Nov 7, 2024 · 3 comments
Open

TextBlock.TextAlignment broken after upgrading from 11.1.4 to 11.2.0 #17450

Tyrrrz opened this issue Nov 7, 2024 · 3 comments
Labels

Comments

@Tyrrrz
Copy link

Tyrrrz commented Nov 7, 2024

Describe the bug

The following element tree:

<StackPanel
    Margin="8,32,8,8"
    HorizontalAlignment="Center"
    IsVisible="{Binding !Downloads.Count}"
    Orientation="Vertical">
    <materialIcons:MaterialIcon
        Width="256"
        Height="256"
        HorizontalAlignment="Center"
        Foreground="{DynamicResource MaterialDividerBrush}"
        Kind="Youtube" />

    <TextBlock
        HorizontalAlignment="Center"
        FontSize="18"
        FontWeight="Light"
        LineSpacing="8"
        TextAlignment="Center"
        TextWrapping="Wrap">
        <Run Text="Copy-paste a" />
        <Run FontWeight="SemiBold" Text="URL" />
        <Run Text="or enter a" />
        <Run FontWeight="SemiBold" Text="search query" />
        <Run Text="to start downloading" />
        <LineBreak />
        <Run Text="Press" />
        <Run FontWeight="SemiBold" Text="Shift+Enter" />
        <Run Text="to add multiple items" />
    </TextBlock>
</StackPanel>

Is rendered differently between 11.1.4 and 11.2.0.

On 11.1.4 it's rendered correctly:

image

On 11.2.0 it's rendered incorrectly:

image

Removing the TextAlignment property seems to fix the visual issues, but then the text is obviously not aligned as desired:

image

None of the other properties seem to have an effect.

To Reproduce

The project where this happens is open source, so it's easy to reproduce by just checking out the right refs.

To reproduce, simply run the only Avalonia project in the solution. The issue should present itself immediately as soon as the window is opened.

Expected behavior

The text should be center-aligned, as it was before 11.2.0.

Avalonia version

11.2.0

OS

Windows

Additional context

No response

@Tyrrrz Tyrrrz added the bug label Nov 7, 2024
@rabbitism
Copy link
Contributor

#17402

@Tyrrrz
Copy link
Author

Tyrrrz commented Nov 7, 2024

#17402

Thanks. Although in my case, removing HorizontalAligntment on the text block did not help. Is it because the parent element also has HorizontalAlignment?

@Gillibald
Copy link
Contributor

Try this build 11.3.999-cibuild0053119-alpha to make sure the fix is working for you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants