@@ -97,7 +97,7 @@ public static Grid ExtendGrid(int columns, int rows, int width, int height, bool
9797 /// <param name="rowHeights">List of row heights in pixels.</param>
9898 /// <param name="gridLines">Indicates whether grid lines should be shown.</param>
9999 /// <returns>A <see cref="Grid" /> with custom row and column dimensions.</returns>
100- public static Grid ExtendGrid ( List < int > columnWidths , List < int > rowHeights , bool gridLines )
100+ public static Grid ExtendGrid ( List < int > ? columnWidths , List < int > ? rowHeights , bool gridLines )
101101 {
102102 if ( columnWidths == null || rowHeights == null )
103103 {
@@ -121,7 +121,7 @@ public static Grid ExtendGrid(List<int> columnWidths, List<int> rowHeights, bool
121121 /// <param name="rowHeights">Custom row heights if any, null otherwise.</param>
122122 /// <returns>A <see cref="Grid" /> configured with the specified parameters.</returns>
123123 private static Grid InitializeGridBase ( bool gridLines , int width , int height ,
124- IReadOnlyCollection < int > columnWidths , IReadOnlyCollection < int > rowHeights )
124+ IReadOnlyCollection < int > ? columnWidths , IReadOnlyCollection < int > ? rowHeights )
125125 {
126126 var dynamicGrid = new Grid
127127 {
@@ -169,8 +169,13 @@ private static Grid InitializeGridBase(bool gridLines, int width, int height,
169169 }
170170
171171 /// <summary>
172- /// Validates the grid parameters to ensure they are non-negative.
172+ /// Validates the grid parameters to ensure they are non-negative.
173173 /// </summary>
174+ /// <param name="columns">The columns.</param>
175+ /// <param name="rows">The rows.</param>
176+ /// <param name="width">The width.</param>
177+ /// <param name="height">The height.</param>
178+ /// <exception cref="Common.Controls.CommonControlsException"></exception>
174179 private static void ValidateParameters ( int columns , int rows , int width = 1 , int height = 1 )
175180 {
176181 if ( columns < 0 || rows < 0 || width < 1 || height < 1 )
@@ -180,11 +185,19 @@ private static void ValidateParameters(int columns, int rows, int width = 1, int
180185 }
181186
182187 /// <summary>
183- /// Calculates the total width of the grid.
188+ /// Calculates the total width of the grid.
184189 /// </summary>
185- private static int CalculateTotalWidth ( IEnumerable < int > columnWidths )
190+ /// <param name="columnWidths">The column widths.</param>
191+ /// <returns>The column width of the grid.</returns>
192+ /// <exception cref="Common.Controls.CommonControlsException"></exception>
193+ private static int CalculateTotalWidth ( IEnumerable < int > ? columnWidths )
186194 {
187195 var totalWidth = 0 ;
196+ if ( columnWidths == null )
197+ {
198+ return totalWidth ;
199+ }
200+
188201 foreach ( var width in columnWidths )
189202 {
190203 if ( width < 0 )
@@ -199,11 +212,19 @@ private static int CalculateTotalWidth(IEnumerable<int> columnWidths)
199212 }
200213
201214 /// <summary>
202- /// Calculates the total height of the grid.
215+ /// Calculates the total height of the grid.
203216 /// </summary>
204- private static int CalculateTotalHeight ( IEnumerable < int > rowHeights )
217+ /// <param name="rowHeights">The row heights.</param>
218+ /// <returns>The height we need for the grid.</returns>
219+ /// <exception cref="Common.Controls.CommonControlsException"></exception>
220+ private static int CalculateTotalHeight ( IEnumerable < int > ? rowHeights )
205221 {
206222 var totalHeight = 0 ;
223+ if ( rowHeights == null )
224+ {
225+ return totalHeight ;
226+ }
227+
207228 foreach ( var height in rowHeights )
208229 {
209230 if ( height < 0 )
0 commit comments