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

[UWP] Only reset ListView DataContext on INotifyCollectionChanged Reset #2453

Merged
merged 3 commits into from
Apr 16, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion Xamarin.Forms.Platform.UAP/ListViewRenderer.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Linq;
using System.Threading.Tasks;
Expand Down Expand Up @@ -79,7 +81,12 @@ protected override void OnElementChanged(ElementChangedEventArgs<ListView> e)

void OnCollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
{
List.DataContext = new CollectionViewSource { Source = Element.ItemsSource, IsSourceGrouped = Element.IsGroupingEnabled };
if (e.Action == NotifyCollectionChangedAction.Reset)
{
List.DataContext =
new CollectionViewSource { Source = Element.ItemsSource, IsSourceGrouped = Element.IsGroupingEnabled };
}

List.UpdateLayout();
}

Expand Down