Skip to content

Incorrect TextBlock measure in Grid #4212

Closed

Description

@xperiandri

Having 2 states

image
image

In the portrait, mode measure happens incorrectly

image

The same happens on WASM

When launched then shinked:
image

When shrinked then launched:
image
image

See source at https://github.com/xperiandri/Elmish.Uno/blob/622fba4da5e2e691cac6f7e39773d26241f4a149/src/Samples/Samples.Shared/SingleCounterPage.xaml#L96

Current behavior

When a piece of UI moves from one row and column of a Grid to another, then the row width is not recalculated

Expected behavior

Grid recalculates on children Grid.Row or Grid.Column changes

How to reproduce it (as minimally and precisely as possible)

https://github.com/xperiandri/Elmish.Uno/
SimpleCounter sample

Workaround

Maybe invalidating measure in code will work.

Environment

NuGet Package:

  • Uno.UI / Uno.UI.WebAssembly / Uno.UI.Skia
  • Uno.WinUI / Uno.WinUI.WebAssembly / Uno.WinUI.Skia
  • Uno.SourceGenerationTasks
  • Uno.UI.RemoteControl / Uno.WinUI.RemoteControl
  • Other:

NuGet Package Version(s):

<PackageReference Include="Elmish" Version="3.1.0" />
<PackageReference Include="FSharp.Control.FusionTasks" Version="2.0.2" />
<PackageReference Include="Uno.Core" Version="2.0.0" />
<PackageReference Include="Uno.UI" Version="3.0.17" />

Affected platform(s):

  • iOS
  • Android
  • WebAssembly
  • WebAssembly renderers for Xamarin.Forms
  • macOS
  • Skia
    • WPF
    • GTK (Linux)
    • Tizen
  • Windows
  • Build tasks
  • Solution Templates

Activity

  1. added
    kind/bug
    triage/untriaged
    on Oct 2, 2020
  2. jeromelaban commented on Oct 5, 2020

    @jeromelaban
    Member

    Grid.Row and Colunms updates generally work properly, but StateTriggers may not. Could you validate that the Grid.Row/Columns values are what you expect by adding a TextBlock like this in the xaml :

    <TextBlock Text="{Binding (Grid.Row), ElementName=grid}" />
  3. xperiandri commented on Oct 5, 2020

    @xperiandri
    ContributorAuthor

    image

    Value changes. Otherwise, the grid wouldn't go to the down row

  4. xperiandri commented on Oct 5, 2020

    @xperiandri
    ContributorAuthor

    The issue is that measure is not invalidated. Maybe because of Grid.Row/Column are set as animation

  5. jeromelaban commented on Oct 5, 2020

    @jeromelaban
    Member

    I'm not sure of what I see here, does the TextBlock displayed value change when the visual state changes ?

  6. xperiandri commented on Oct 5, 2020

    @xperiandri
    ContributorAuthor

    Yes, the number 1 in the top left corner is what you have asked to add

  7. xperiandri commented on Oct 5, 2020

    @xperiandri
    ContributorAuthor

    image

    Here it is 0

  8. jeromelaban commented on Oct 7, 2020

    @jeromelaban
    Member

    Thanks. If you can create a repro using the default Uno templates, It would help significantly.

  9. added
    project/layout 🧱
    and removed
    triage/untriaged
    on Oct 7, 2020
  10. xperiandri commented on Oct 7, 2020

    @xperiandri
    ContributorAuthor
  11. jeromelaban commented on Oct 8, 2020

    @jeromelaban
    Member

    Thanks for the repro. We need those to avoid spending time recreating the issue that is generally not obvious.

    In this case, the issue is not that the measure is not happening, but rather than the grid measures the textblock incorrectly. We're going to be updating the grid's source with the original WinUI's code, and this kind of behavior will disapear.

  12. changed the title [-]Measure is not triggered on Grid.Row/Column property change[/-] [+]Incorrect TextBlock measure in Grid[/+] on Oct 8, 2020
  13. xperiandri commented on Oct 8, 2020

    @xperiandri
    ContributorAuthor

    Cool!

  14. added
    area/grid
    on Oct 8, 2020
  15. added
    difficulty/tbd
    on Feb 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/griddifficulty/tbdkind/bugproject/layout 🧱

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions