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

[UWP] Fixed sync of ListView items with ListViewProxy #2512

Merged
merged 1 commit into from
May 24, 2018
Merged

[UWP] Fixed sync of ListView items with ListViewProxy #2512

merged 1 commit into from
May 24, 2018

Conversation

paymicro
Copy link
Contributor

@paymicro paymicro commented Apr 20, 2018

Description of Change

ItemsSource wrapped in an ObservableCollection
Added processing for adding and removing items.
Screencast: https://www.screencast.com/t/LrPoEiM8a6v0

Bugs Fixed

Fixes #2485
Fixes #2809

API Changes

--

Behavioral Changes

Correct Items shown when the collection is changed

PR Checklist

  • Has tests (if omitted, state reason in description)
  • Rebased on top of master at time of PR
  • Changes adhere to coding standard
  • Consolidate commits as makes sense

@rmarinho
Copy link
Member

@hartez can you run uwp tests on this?

@rmarinho rmarinho requested a review from hartez April 24, 2018 14:42
@rmarinho
Copy link
Member

this doesn't fix #2486 i wonder if the root cause si not the same.

@paymicro
Copy link
Contributor Author

@rmarinho in #2486 more serious problem with equals string items in different groups.
In test when creates a first cell in second group

var indices = templatedItems.GetGroupAndIndexOfItem(context);
templatedItems.GetGroupAndIndexOfItem("I am a short text") returns the first cell of the first group.
The second group begins to have cells of the first group.

Copy link
Contributor

@hartez hartez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This currently fail the test in Issue1875.

@hartez
Copy link
Contributor

hartez commented May 7, 2018

When I run the Issue 1875 test with these changes, I get an ArgumentOutOfRange exception:

   at System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)
   at System.Collections.ObjectModel.Collection`1.Insert(Int32 index, T item)
   at Xamarin.Forms.Platform.UWP.ListViewRenderer.OnCollectionChanged(Object sender, NotifyCollectionChangedEventArgs e)
   at Xamarin.Forms.Internals.TemplatedItemsList`2.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
   at Xamarin.Forms.Internals.TemplatedItemsList`2.OnProxyCollectionChanged(Object sender, NotifyCollectionChangedEventArgs e)
   at Xamarin.Forms.ListProxy.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
   at Xamarin.Forms.ListProxy.<>c__DisplayClass33_0.<OnCollectionChanged>b__0()
   at Xamarin.Forms.ListProxy.OnCollectionChanged(Object sender, NotifyCollectionChangedEventArgs e)
   at Xamarin.Forms.ListProxy.WeakNotifyProxy.OnCollectionChanged(Object sender, NotifyCollectionChangedEventArgs e)
   at System.Collections.ObjectModel.ObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
   at System.Collections.ObjectModel.ObservableCollection`1.InsertItem(Int32 index, T item)
   at System.Collections.ObjectModel.Collection`1.Add(T item)
   at Xamarin.Forms.Controls.Issue1875.MainViewModel.<LoadData>d__12.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
   at Xamarin.Forms.Controls.Issue1875.<LoadData>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
   at Xamarin.Forms.Controls.Issue1875.<<-ctor>b__0_0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<>c.<ThrowAsync>b__6_0(Object state)
   at System.Threading.WinRTSynchronizationContextBase.Invoker.InvokeCore()

@jassmith
Copy link

jassmith commented May 8, 2018

Feel free to reopen if 1875 starts working

@jassmith jassmith closed this May 8, 2018
@paymicro
Copy link
Contributor Author

I fixed the exception in test 1875 and append changes in the first commit.
Unfortunately, I can't reopen PR.

@hartez hartez reopened this May 10, 2018
@bholmes bholmes added this to the 3.0.0 milestone May 22, 2018
@bholmes bholmes removed the 3.0.0 label May 22, 2018
@StephaneDelcroix
Copy link
Member

this PR is conflicting with #2773 that was just merged. could you please revisit ?

@paymicro
Copy link
Contributor Author

ready!

@StephaneDelcroix
Copy link
Member

thx

@rmarinho rmarinho merged commit 8f3d7af into xamarin:3.0.0 May 24, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants