@@ -34,12 +34,12 @@ public class ContentRow : RowBase
3434 /// <summary>
3535 /// Gets the list of cells contained by the row.
3636 /// </summary>
37- private readonly List < ContentCell > cells = new ( ) ;
37+ protected List < ContentCell > Cells { get ; private set ; } = [ ] ;
3838
3939 /// <summary>
4040 /// Gets the number of cells contained by the current instance.
4141 /// </summary>
42- public override int CellCount => cells . Count ;
42+ public override int CellCount => Cells . Count ;
4343
4444 /// <summary>
4545 /// Gets or sets the cell at the specified index.
@@ -49,8 +49,8 @@ public class ContentRow : RowBase
4949 /// <exception cref="ArgumentOutOfRangeException"></exception>
5050 public ContentCell this [ int index ]
5151 {
52- get => cells [ index ] ;
53- set => cells [ index ] = value ;
52+ get => Cells [ index ] ;
53+ set => Cells [ index ] = value ;
5454 }
5555
5656 /// <summary>
@@ -183,7 +183,7 @@ public ContentCell AddCell(ContentCell cell = null)
183183 cell = new ContentCell ( ) ;
184184
185185 cell . ParentRow = this ;
186- cells . Add ( cell ) ;
186+ Cells . Add ( cell ) ;
187187
188188 return cell ;
189189 }
@@ -192,7 +192,7 @@ public ContentCell AddCell(ContentCell cell = null)
192192 /// Adds a new cell to the current instance of <see cref="ContentRow"/>.
193193 /// </summary>
194194 /// <returns>The newly created cell.</returns>
195- public ContentCell AddCell ( string cellContent )
195+ public ContentCell AddCell ( string cellContent , Action < ContentCell > config = null )
196196 {
197197 ContentCell cell = new ( )
198198 {
@@ -202,7 +202,9 @@ public ContentCell AddCell(string cellContent)
202202 if ( cellContent != null )
203203 cell . Content = new MultilineText ( cellContent ) ;
204204
205- cells . Add ( cell ) ;
205+ config ? . Invoke ( cell ) ;
206+
207+ Cells . Add ( cell ) ;
206208
207209 return cell ;
208210 }
@@ -211,7 +213,7 @@ public ContentCell AddCell(string cellContent)
211213 /// Adds a new cell to the current instance of <see cref="ContentRow"/>.
212214 /// </summary>
213215 /// <returns>The newly created cell.</returns>
214- public ContentCell AddCell ( MultilineText cellContent )
216+ public ContentCell AddCell ( MultilineText cellContent , Action < ContentCell > config = null )
215217 {
216218 ContentCell cell = new ( )
217219 {
@@ -221,7 +223,9 @@ public ContentCell AddCell(MultilineText cellContent)
221223 if ( cellContent != null )
222224 cell . Content = cellContent ;
223225
224- cells . Add ( cell ) ;
226+ config ? . Invoke ( cell ) ;
227+
228+ Cells . Add ( cell ) ;
225229
226230 return cell ;
227231 }
@@ -230,7 +234,7 @@ public ContentCell AddCell(MultilineText cellContent)
230234 /// Adds a new cell to the current instance of <see cref="ContentRow"/>.
231235 /// </summary>
232236 /// <returns>The newly created cell.</returns>
233- public ContentCell AddCell ( object cellContent )
237+ public ContentCell AddCell ( object cellContent , Action < ContentCell > config = null )
234238 {
235239 ContentCell cell = new ( )
236240 {
@@ -240,7 +244,9 @@ public ContentCell AddCell(object cellContent)
240244 if ( cellContent != null )
241245 cell . Content = new MultilineText ( cellContent . ToString ( ) ) ;
242246
243- cells . Add ( cell ) ;
247+ config ? . Invoke ( cell ) ;
248+
249+ Cells . Add ( cell ) ;
244250
245251 return cell ;
246252 }
@@ -254,7 +260,7 @@ public ContentCell AddCell(object cellContent)
254260 if ( cell is not ContentCell contentCell )
255261 return null ;
256262
257- int indexOfCell = cells . IndexOf ( contentCell ) ;
263+ int indexOfCell = Cells . IndexOf ( contentCell ) ;
258264
259265 return indexOfCell == - 1
260266 ? null
@@ -268,7 +274,7 @@ public ContentCell AddCell(object cellContent)
268274 /// <returns>An enumeration of the visible cells contained by the current instance.</returns>
269275 public override IEnumerable < CellBase > EnumerateVisibleCells ( )
270276 {
271- return cells
277+ return Cells
272278 . Where ( ( x , i ) => ParentDataGrid ? . Columns [ i ] ? . IsVisible ?? true )
273279 . ToList ( ) ;
274280 }
@@ -279,6 +285,6 @@ public override IEnumerable<CellBase> EnumerateVisibleCells()
279285 /// <returns>An enumeration of all the cell contained by the current instance.</returns>
280286 public override IEnumerator < CellBase > GetEnumerator ( )
281287 {
282- return cells . GetEnumerator ( ) ;
288+ return Cells . GetEnumerator ( ) ;
283289 }
284290}
0 commit comments