From aa17d0cbe10460376b46c96d01b4a9472f41f352 Mon Sep 17 00:00:00 2001 From: Asaf Mahlev Date: Wed, 28 Oct 2026 15:34:13 +0200 Subject: [PATCH] Rebuild groups without rendering an empty table in between OnCollectionViewPropertyChanged detached ItemsSource, yielded, then reattached it, so a frame rendered with no items whenever the grouping changed: the table flickered empty before showing the new groups. Detach and reattach in one go. Co-Authored-By: Claude Opus 5.5 --- src/TableView.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/TableView.cs b/src/TableView.cs index f5fff8f6..7ac7eeae 100644 --- a/src/TableView.cs +++ b/src/TableView.cs @@ -105,15 +105,16 @@ private void OnCollectionViewPropertyChanging(object? sender, PropertyChangingEv /// /// Handles the PropertyChanged event of the CollectionView. /// - private async void OnCollectionViewPropertyChanged(object? sender, PropertyChangedEventArgs e) + private void OnCollectionViewPropertyChanged(object? sender, PropertyChangedEventArgs e) { if (e.PropertyName == nameof(CollectionView.CollectionGroups)) { _collectionView.CollectionGroups?.VectorChanged += OnCollectionViewGroupDescriptionsChanged; + // Detach and reattach so the ListView rebuilds its groups. Both in one go: yielding between them let a + // frame render the table empty, a visible flicker on every grouping change. _shouldThrowBaseProeprtyChangedException = false; base.ItemsSource = null; - await Task.Yield(); base.ItemsSource = _collectionView; _shouldThrowBaseProeprtyChangedException = true; }