From c6cfcbacba78d9a515b41fb6b9d3434aa35aa34d Mon Sep 17 00:00:00 2001 From: Andrej Benedik Date: Mon, 24 Mar 2025 21:29:42 +0100 Subject: [PATCH] Prevented setting 0 to ColumnSpan or RowSpan. (#18516) This prevents exception that is thrown in Layoutable.MeasureCore if 0 is set to ColumnSpan (for example by calling Grid.SetColumnSpan). In WPF, the ColumnSpan property immediatelly throws ArgumentOfOutRange exception when 0 is set to ColumSpan. --- src/Avalonia.Controls/Grid.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Avalonia.Controls/Grid.cs b/src/Avalonia.Controls/Grid.cs index 956ee55007..6e97875b27 100644 --- a/src/Avalonia.Controls/Grid.cs +++ b/src/Avalonia.Controls/Grid.cs @@ -2780,7 +2780,7 @@ namespace Avalonia.Controls AvaloniaProperty.RegisterAttached( "ColumnSpan", defaultValue: 1, - validate: v => v >= 0); + validate: v => v > 0); /// /// RowSpan property. This is an attached property. @@ -2796,7 +2796,7 @@ namespace Avalonia.Controls AvaloniaProperty.RegisterAttached( "RowSpan", defaultValue: 1, - validate: v => v >= 0); + validate: v => v > 0); /// /// IsSharedSizeScope property marks scoping element for shared size.