@@ -649,8 +649,7 @@ private static TableViewBoundColumn GetTableViewColumnFromType(string? propertyN
649649 /// </summary>
650650 private void ItemsSourceChanged ( DependencyPropertyChangedEventArgs e )
651651 {
652- var defer = _collectionView . DeferRefresh ( ) ;
653- {
652+ using var defer = _collectionView . DeferRefresh ( ) ;
654653 _collectionView . Source = null ! ;
655654
656655 if ( e . NewValue is IList source )
@@ -660,8 +659,6 @@ private void ItemsSourceChanged(DependencyPropertyChangedEventArgs e)
660659 _collectionView . Source = source ;
661660 }
662661 }
663- defer . Complete ( ) ;
664- }
665662
666663 /// <summary>
667664 /// Ensures that columns are automatically generated based on the current state of the control.
@@ -925,6 +922,7 @@ private void DeselectAllItems()
925922 private void DeselectAllCells ( )
926923 {
927924 if ( SelectedCellRanges . Count is 0 ) return ;
925+
928926 SelectedCellRanges . Clear ( ) ;
929927 OnCellSelectionChanged ( ) ;
930928 CurrentCellSlot = null ;
@@ -1208,10 +1206,10 @@ public async Task<TableViewCell> ScrollCellIntoView(TableViewCellSlot slot)
12081206 /// <param name="index">The index of the row to scroll into view.</param>
12091207 public async Task < TableViewRow ? > ScrollRowIntoView ( int index )
12101208 {
1211- if ( _scrollViewer is null ) return default ! ;
1209+ if ( _scrollViewer is null || index < 0 ) return default ! ;
12121210
12131211 var item = Items [ index ] ;
1214- index = Items . IndexOf ( item ) ; // if the ItemsSource has duplicate items in it. ScrollIntoView will only bring first index of item.
1212+ index = Items . IndexOf ( item ) ; // if the ItemsSource has duplicate items in it. ScrollIntoView will only bring first index of the item.
12151213 ScrollIntoView ( item ) ;
12161214
12171215 var tries = 0 ;
0 commit comments