Merge pull request #3025 from windows-toolkit/harinikmsft/datagrid

Fix for DataGrid Issue #3010 - NullReferenceException in DataGrid.ComputeDisplayedColumns
This commit is contained in:
Régis Brid 2019-10-16 14:53:56 -07:00 коммит произвёл GitHub
Родитель 7f3b4c12d1 ae0af30526
Коммит 7c933163ff
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 11 добавлений и 0 удалений

Просмотреть файл

@ -1209,6 +1209,12 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
{
cx += _negHorizontalOffset;
_horizontalOffset -= _negHorizontalOffset;
if (_horizontalOffset < DATAGRID_roundingDelta)
{
// Snap to zero to avoid trying to partially scroll in first scrolled off column below
_horizontalOffset = 0;
}
_negHorizontalOffset = 0;
}
else
@ -1217,6 +1223,11 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
_negHorizontalOffset -= displayWidth - cx;
cx = displayWidth;
}
// Make sure the HorizontalAdjustment is not greater than the new HorizontalOffset
// since it would cause an assertion failure in DataGridCellsPresenter.ShouldDisplayCell
// called by DataGridCellsPresenter.MeasureOverride.
this.HorizontalAdjustment = Math.Min(this.HorizontalAdjustment, _horizontalOffset);
}
// second try to scroll entire columns