Skip to content

[DataGrid] Cells no longer visible when the DataGrid is resized, until resize again #5010

Open
@Xiaoy312

Description

@Xiaoy312

Describe the bug

Image
In certain situation (more on that later, see 'Additional context'), when the data-grid resizes from needing a scrollbar to not, certain cells is no longer visible.

  • Is this bug a regression in the toolkit? If so, what toolkit version did you last see it work:

Steps to Reproduce

  • Can this be reproduced in the Sample App? (Either in a sample as-is or with new XAML pasted in the editor.) If so, please provide custom XAML or steps to reproduce. If not, let us know why it can't be reproduced (e.g. more complex setup, environment, dependencies, etc...)

Steps to reproduce the behavior:

  1. Given the following repro: K211Repro.zip
  2. Launch either: K211Repro (WinAppSDK Packaged)(windows) or K211Repro (Desktop)(uno)
  3. Resize the window, until the last value in "Columns Widths:" is slightly smaller than the 2nd last value
  4. Click on "Toggle Split Mode" to go into split mode
  5. Scroll the DataGrid all the way to the right.
  6. Click on "Toggle Split Mode" again to go into details mode
  7. Notice the cell on R2C6 is now missing

Expected behavior

All cells should remain visible.

Screenshots

Image

Environment

NuGet Package(s):
- [email protected]
- [email protected]

Windows 10 Build Number: 22H2 (OS Build19045.5131)
App min and target version: net8.0-windows10.0.26100
Device form factor: Desktop
Visual Studio: 2022 (version: 17.11.4)

Additional context

The specific problem happens when the "filler" cell is smaller than the last column cell, and when the DataGrid was previously on a scrolled state, and got resized to be given enough width to render all the columns.

@ ComputeDisplayedColumns
    if (cx < displayWidth && firstDisplayedScrollingCol >= 0)
    ^ here, we make three attempts to stabilize the displayed columns WHEN the available space grew:
        1. comsume the left part of partially visible column: `aaabbbcc[cdddeeefff] -> aaabbb[cccdddeeefff]`
        2. comsume non-visible columns on the left: `aaabbb[cccdddeeefff -> [aaabbccdddeeefff]`
        3. if grew too much, partially cut off the current visible column `[aaabbccdddeeefff] -> aa[abbccdddeeefff]`
^ we updated the HorizontalAdjustment in the 1st pass*, but not in the 2nd pass.
    ^ *1st pass update: here we are just clamping the value to avoid assertion error...
        the actual value (being clamped) is coming from (DGRowsPresenter::MeasureOverride > DG::RowsPresenterAvailableSize.set)
        whose calculation is based on the HorizontalOffset that will be changed in the 2nd pass, voiding this value completely...
    ^ what we need to do here is to update HorizontalAdjustment in the 2nd pass
        which should be set to (available_space - consumed_space)
        if all the columns are fully rendered

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions