Skip to content

Commit 5b25255

Browse files
Xiaoy312mergify[bot]
authored andcommitted
fix(DataGrid): not displaying cells from last columns when resized from scrolled state
(cherry picked from commit 9d63dc2)
1 parent 7b3d97d commit 5b25255

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

CommunityToolkit.WinUI.UI.Controls.DataGrid/DataGrid/DataGridColumns.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1245,6 +1245,14 @@ private bool ComputeDisplayedColumns()
12451245
_horizontalOffset -= GetEdgedColumnWidth(dataGridColumn);
12461246
dataGridColumn = this.ColumnsInternal.GetPreviousVisibleScrollingColumn(dataGridColumn);
12471247
}
1248+
1249+
if (_horizontalOffset == 0 && cx < displayWidth)
1250+
{
1251+
// if the columns have been scrolled, and all visible columns are fully rendered in the available space,
1252+
// then HorizontalAdjustment needs to be updated so that DataGridCellsPresenter.ShouldDisplayCell
1253+
// don't hide columns based on the old value.
1254+
HorizontalAdjustment = displayWidth - cx;
1255+
}
12481256
}
12491257

12501258
// third try to partially scroll in first scrolled off column

0 commit comments

Comments
 (0)