Jamieh
Topic Author
Posts: 44
Joined: 12 Apr 2019, 00:30

Issue with ObservableCollection.Move

02 Sep 2019, 10:25

Using Noesis in Unity to rewrite/port an old Silverlight App. Most things are going great. However I've run into a problem.

I have an ObservableCollection<T> that is a dependency property of a custom control. This collection is being put into a ListView.

The initial binding is working find, and I'm getting the data. However, I'm attempting to sort the data using ObservableCollection.Move(), and when I do that I'm getting this error in Unity:

[noesis] Unimplemented
UnityEngine.Debug:LogError(Object)
NoesisUnity:UnityLog(Int32, String) (at Assets/NoesisGUI/Plugins/NoesisUnity.cs:116)
Noesis.Extend:Noesis_LaunchCollectionChangedEvent(IntPtr, IntPtr, Int32, IntPtr, IntPtr, Int32, Int32)
Noesis.Extend:NotifyCollectionChanged(Object, NotifyCollectionChangedEventArgs) (at Assets/NoesisGUI/Plugins/API/Core/Extend.cs:4359)
System.Collections.ObjectModel.ObservableCollection`1:Move(Int32, Int32)

Am I doing something here that Noesis doesn't support? Should I be sorting the ObservableCollection via a different method that .Move()? If I recreate the ObservableCollection I can get it to work, but then I lose the binding to the viewmodel that allows me to remove/add items.

I can post code if needed, however I'd like to get a sense of whether what I'm trying to do is supported or not. Or if someone has seen this specific error before and might know what I've done wrong. Thanks!

Tags:
 
User avatar
jsantos
Site Admin
Posts: 2906
Joined: 20 Jan 2012, 17:18
Contact:

Re: Issue with ObservableCollection.Move

03 Sep 2019, 02:28

This is not properly implemented. I am not sure how this was not reported before, could you please open a ticket about it?
 
User avatar
jsantos
Site Admin
Posts: 2906
Joined: 20 Jan 2012, 17:18
Contact:

Re: Issue with ObservableCollection.Move

03 Sep 2019, 02:32

As a workaround, for now, you can use Sets to sort the collection. Sorry for the inconvenience.
 
Jamieh
Topic Author
Posts: 44
Joined: 12 Apr 2019, 00:30

Re: Issue with ObservableCollection.Move

03 Sep 2019, 07:44

Cool, I just wasn't sure if I was doing something wrong or unsupported.

I found a hack/workaround. It involves tracking the change notification of the ObservableCollection and rebinding ItemsSource anytime anything changes. Probably not great for perf, but it actually seems to work fine.

I will open a ticket. Thanks!
 
User avatar
jsantos
Site Admin
Posts: 2906
Joined: 20 Jan 2012, 17:18
Contact:

Re: Issue with ObservableCollection.Move

04 Sep 2019, 23:51

Thanks for the ticket (#1550)

Who is online

Users browsing this forum: Google [Bot] and 1 guest