Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
added comments
  • Loading branch information
winston-de committed Jun 4, 2021
commit 8570e3cf1a829face93d58b047e983a9f1081b53
Original file line number Diff line number Diff line change
Expand Up @@ -147,13 +147,15 @@ protected override Size MeasureOverride(VirtualizingLayoutContext context, Size
double availableWidth = availableSize.Width;
double availableHeight = availableSize.Height;

// This ternary prevents the column width from being NaN, which would otherwise cause an exception when measuring item sizes
double columnWidth = double.IsNaN(DesiredColumnWidth) ? availableWidth : Math.Min(DesiredColumnWidth, availableWidth);
if (columnWidth != state.ColumnWidth)
{
// The items will need to be remeasured
state.Clear();
}

// This ternary prevents the column width from being NaN, which would otherwise cause an exception when measuring item sizes
state.ColumnWidth = double.IsNaN(DesiredColumnWidth) ? availableWidth : Math.Min(DesiredColumnWidth, availableWidth);
int numColumns = Math.Max(1, (int)Math.Floor(availableWidth / state.ColumnWidth));

Expand Down