Skip to content

<Grid> wrongly arrange <TextBlock> when hosted in a <Canvas> #3483

Closed

Description

@carldebilly

Bug

Current behavior

Using the following XAML:

<Canvas>
    <Grid Background="Red">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>
        <TextBlock Text="This should not be cut" Foreground="White" FontSize="30" />
    </Grid>
</Canvas>

See this online there: http://playground.platform.uno/#e14f50cd

You see the following result:
image

Expected result

(as seen using the excellent XAML Studio tool)
image

Environment

Bug found on Wasm platform. Unsure if it's present on other platforms.

Nuget Package: Uno.UI v3.0.0-dev.672

Affected platform(s):

  • iOS
  • Android
  • WebAssembly
  • WebAssembly renderers for Xamarin.Forms
  • macOS
  • Windows
  • Build tasks
  • Solution Templates

Activity

  1. added
    kind/bug
    platform/wasm 🌐
    on Jul 3, 2020
  2. changed the title [-][WASM] Grid wrongly arrange <TextBlock> when hosted in a <Canvas>[/-] [+][WASM] <Grid> wrongly arrange <TextBlock> when hosted in a <Canvas>[/+] on Jul 3, 2020
  3. carldebilly commented on Jul 3, 2020

    @carldebilly
    MemberAuthor

    After few tries on XAML Studio, here's the hyopthesis:

    • This occurs when the <Grid> is measured using an infinite length. It's how the <Canvas> is measuring its children.
    • Confirmed by replacing the <Canvas> in the repro XAML by a <StackPanel Orientation="Horizontal">: same bug.
    • Hypothesis: it looks like the <Grid> will translate the * sizes to Auto during the measure phase when measured using an infinite size.
      • On Uno, it looks like the Measure() phase is behaving like on Windows, but during the Arrange() phase, it looks like the * to Auto mode is forgot and the available size is distributed using the stars weight.
  4. self-assigned this
    on Jul 4, 2020
  5. changed the title [-][WASM] <Grid> wrongly arrange <TextBlock> when hosted in a <Canvas>[/-] [+]<Grid> wrongly arrange <TextBlock> when hosted in a <Canvas>[/+] on Jul 4, 2020
  6. removed
    platform/wasm 🌐
    on Jul 4, 2020
  7. modified the milestone: 3.1 on Aug 29, 2020
  8. added
    project/layout 🧱
    on Sep 21, 2020
  9. added
    area/grid
    on Oct 8, 2020
  10. removed their assignment
    on Dec 2, 2020
  11. added
    difficulty/tbd
    on Feb 15, 2021
  12. self-assigned this
    on Apr 23, 2021
  13. added this to the 3.7 milestone on Apr 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area/griddifficulty/tbdkind/bugproject/layout 🧱

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions