@@ -294,27 +294,11 @@ e.PropertyName is nameof(TableViewColumn.IsFrozen)) &&
294294 }
295295 else if ( e . PropertyName is nameof ( TableViewBoundColumn . ElementStyle ) )
296296 {
297- foreach ( var cell in Cells )
298- {
299- if ( cell . Column == e . Column
300- && cell . Content is FrameworkElement element
301- && cell . Column is TableViewBoundColumn boundColumn
302- && ( TableView ? . IsEditing is false || TableView ? . CurrentCellSlot != cell . Slot ) )
303- {
304- element . Style = boundColumn . ElementStyle ;
305- }
306- }
297+ EnsureElementStyle ( e . Column ) ;
307298 }
308299 else if ( e . PropertyName is nameof ( TableViewBoundColumn . EditingElementStyle ) )
309300 {
310- if ( TableView ? . IsEditing is true
311- && TableView . CurrentCellSlot is not null
312- && e . Column is TableViewBoundColumn boundColumn
313- && TableView . GetCellFromSlot ( TableView . CurrentCellSlot . Value ) is { } cell
314- && cell . Content is FrameworkElement element )
315- {
316- element . Style = boundColumn . EditingElementStyle ;
317- }
301+ EnsureEditingElementStyle ( e . Column ) ;
318302 }
319303 }
320304
@@ -430,6 +414,33 @@ private void UpdateCellsState()
430414 }
431415 }
432416
417+ private void EnsureElementStyle ( TableViewColumn column )
418+ {
419+ foreach ( var cell in Cells )
420+ {
421+ if ( cell . Column == column
422+ && cell . Content is FrameworkElement element
423+ && cell . Column is TableViewBoundColumn boundColumn
424+ && ( TableView ? . IsEditing is false || TableView ? . CurrentCellSlot != cell . Slot ) )
425+ {
426+ element . Style = boundColumn . ElementStyle ;
427+ }
428+ }
429+ }
430+
431+ private void EnsureEditingElementStyle ( TableViewColumn column )
432+ {
433+ if ( TableView ? . IsEditing is true
434+ && TableView . CurrentCellSlot is not null
435+ && column is TableViewBoundColumn boundColumn
436+ && TableView . GetCellFromSlot ( TableView . CurrentCellSlot . Value ) is { } cell
437+ && cell . Column == column
438+ && cell . Content is FrameworkElement element )
439+ {
440+ element . Style = boundColumn . EditingElementStyle ;
441+ }
442+ }
443+
433444 /// <summary>
434445 /// Ensures the cells style is applied.
435446 /// </summary>
0 commit comments