diff --git a/components/DataTable/src/DataTable/DataTable.cs b/components/DataTable/src/DataTable/DataTable.cs index 65a3c1b81..f42df3e50 100644 --- a/components/DataTable/src/DataTable/DataTable.cs +++ b/components/DataTable/src/DataTable/DataTable.cs @@ -93,7 +93,11 @@ protected override Size MeasureOverride(Size availableSize) // then invalidate the child arranges [don't re-measure and cause loop]...) // For now, we'll just use the header content as a guideline to see if things work. - column.Measure(new Size(availableSize.Width - fixedWidth - autoSized, availableSize.Height)); + + // Avoid negative values when columns don't fit `availableSize`. Otherwise the `Size` constructor will throw. + double width = availableSize.Width - fixedWidth - autoSized; + width = Math.Max(width, 0); + column.Measure(new Size(width, availableSize.Height)); // Keep track of already 'allotted' space, use either the maximum child size (if we know it) or the header content autoSized += Math.Max(column.DesiredSize.Width, column.MaxChildDesiredWidth);