AvaloniaUI / Avalonia.Controls.TreeDataGrid

A combined TreeView/DataGrid for Avalonia.
MIT License
233 stars 48 forks source link

Rows and columns visually lose alignment when refreshing the grid and setting the Value of the horizontal scrollbar. #251

Closed artizzq closed 4 months ago

artizzq commented 5 months ago

When I scroll horizontal scrollbar to needed value using this piece of code:

                            var horizontalScroll = (((((TDG.GetVisualChildren().Cast<Visual>().ToList()[0] as Border).GetVisualChildren().Cast<Visual>().ToList()[0] as DockPanel).GetVisualChildren().Cast<Visual>().ToList()[1] as ScrollViewer).GetVisualChildren().Cast<Visual>().ToList()[0] as Grid).GetVisualChildren().Cast<Visual>().ToList()[1] as ScrollBar);
                            horizontalScroll.Value = xOffset;

and after that move vertical scroll manually I experience this problem (in picture below) image In total I had over 6k rows loaded to my TreeDataGrid's datasource. All my columns have width set using new GridLength(200, GridUnitType.Pixel) The reason I am setting the offset like this is because using basic TDG.Scroll.Offset often results in not desired position of the scroll. The offset I am setting is based on how many columns I have and what length they have. Visually I get desired result (I move my scroll to focused cell programmatically) but it results in visual elements' collapse.

However, it is solved if I manually move horizontal scroll from left side (first column) to right side (last column)

artizzq commented 5 months ago

I found this issue https://github.com/AvaloniaUI/Avalonia.Controls.TreeDataGrid/issues/6#issue-921267001 but it's already fixed, isn't it? Why do I experience then? Some of my columns have controls like Combobox as editing templates. I wonder could it be the reason of such behaviour

artizzq commented 5 months ago

I experience this when column widths vary, when they are equal it doesnt happen

artizzq commented 4 months ago

Duplicate of https://github.com/AvaloniaUI/Avalonia.Controls.TreeDataGrid/issues/256