Skip to content
This repository was archived by the owner on May 1, 2024. It is now read-only.

Commit 1c88203

Browse files
authored
[UWP] Changes in CollectionViewSource dispose logic (#11919) fixes #11908
* Moved logic to dispose ItemsViewRenderer CollectionViewSource * Removed unnecessary null check
1 parent 133403f commit 1c88203

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

Xamarin.Forms.Platform.UAP/CollectionView/ItemsViewRenderer.cs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -117,21 +117,18 @@ protected virtual void CleanUpCollectionViewSource()
117117
{
118118
observableItemTemplateCollection.CleanUp();
119119
}
120-
}
121120

122-
if (Element?.ItemsSource == null)
123-
{
124-
if (CollectionViewSource?.Source is INotifyCollectionChanged incc)
121+
if (CollectionViewSource.Source is INotifyCollectionChanged incc)
125122
{
126123
incc.CollectionChanged -= ItemsChanged;
127124
}
128125

129-
if (CollectionViewSource != null)
130-
{
131-
CollectionViewSource.Source = null;
132-
}
133-
126+
CollectionViewSource.Source = null;
134127
CollectionViewSource = null;
128+
}
129+
130+
if (Element?.ItemsSource == null)
131+
{
135132
ListViewBase.ItemsSource = null;
136133
return;
137134
}

0 commit comments

Comments
 (0)