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

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

Open
1 of 2 tasks
Xiaoy312 opened this issue Nov 14, 2024 · 0 comments · May be fixed by #5011
Open
1 of 2 tasks

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

Xiaoy312 opened this issue Nov 14, 2024 · 0 comments · May be fixed by #5011

Comments

@Xiaoy312
Copy link

Xiaoy312 commented Nov 14, 2024

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant