File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -56,6 +56,7 @@ public TableView()
5656 RegisterPropertyChangedCallback ( ListViewBase . SelectionModeProperty , OnBaseSelectionModeChanged ) ;
5757
5858 Loaded += OnLoaded ;
59+ Unloaded += OnUnloaded ;
5960 SelectionChanged += TableView_SelectionChanged ;
6061 _collectionView . ItemPropertyChanged += OnItemPropertyChanged ;
6162 }
@@ -319,6 +320,17 @@ private void OnLoaded(object sender, RoutedEventArgs e)
319320 EnsureAutoColumns ( ) ;
320321 }
321322
323+ /// <summary>
324+ /// Handles the Unloaded event of the TableView control.
325+ /// </summary>
326+ private void OnUnloaded ( object sender , RoutedEventArgs e )
327+ {
328+ if ( IsEditing && CurrentCellSlot . HasValue && GetCellFromSlot ( CurrentCellSlot . Value ) is { } currentCell )
329+ {
330+ currentCell . EndEditing ( TableViewEditAction . Commit ) ;
331+ }
332+ }
333+
322334 /// <summary>
323335 /// Handles the PointerWheelChanged event of the ScrollContentPresenter.
324336 /// </summary>
You can’t perform that action at this time.
0 commit comments