Quantcast
Channel: Silverlight Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 801

Commented Issue: Adding groups to LongListSelector on Link event [9422]

$
0
0
I dynamically add groups to a LongListSelector that is bound to an ObservableCollection. When the Link event for the last group is called, I add more groups to the ObservableCollection (that contain items).

The problem is, as soon as I add more groups to the ObservableCollection the items in the group wouldn't show anymore, only the group header shows for the newly added groups. I double checked that the ObservableCollection contains the correct groups and items.

It seems as if the LongListSelector gets flattened when more groups are added.

EDIT: I also tried the following: In the link event of the last group, I set the ItemsSource of the LongListSelector to null, then I load the items and set the ItemsSource again:

void LongListSelector_LinkEven(....)
{
...

if (currentGroup == _lastGrp)
{
myLongListSelector.ItemsSource = null;
var items = LoadNextItems();
myLongListSelector.ItemsSource = items;

}
}

This works, but when I scroll fastly, at some point the connection to the emulator gets lost, due to some serious error I guess.

I tried to catch the exception by setting the debugger to stop on all thrown Exception (handled and unhandled) but to no avail.
Comments: ** Comment from web user: F2006 **

I also get this, here is the exception details:


at System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)
at System.Collections.ObjectModel.Collection`1.Insert(Int32 index, LongListSelectorItem item)
at Microsoft.Phone.Controls.LongListSelector.InsertNewGroups(IList newGroups, Int32 newGroupsIndex)
at Microsoft.Phone.Controls.LongListSelector.OnCollectionChanged(Object sender, NotifyCollectionChangedEventArgs e)
at System.Collections.ObjectModel.ObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
at System.Collections.ObjectModel.ObservableCollection`1.InsertItem(Int32 index, Group`1 item)
at System.Collections.ObjectModel.Collection`1.Add(Group`1 item)
at ContactManager.Roster.AddContact(IObservableContact contact)
at Manager.<>c__DisplayClass4.<PacketProcessorOnGetContacts>b__3()
at System.Reflection.RuntimeMethodInfo.InternalInvoke(RuntimeMethodInfo rtmi, Object obj, BindingFlags invokeAttr, Binder binder, Object parameters, CultureInfo culture, Boolean isBinderDefault, Assembly caller, Boolean verifyAccess, StackCrawlMark& stackMark)
at System.Reflection.RuntimeMethodInfo.InternalInvoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, StackCrawlMark& stackMark)
at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
at System.Delegate.DynamicInvokeOne(Object[] args)
at System.MulticastDelegate.DynamicInvokeImpl(Object[] args)
at System.Delegate.DynamicInvoke(Object[] args)
at System.Windows.Threading.DispatcherOperation.Invoke()
at System.Windows.Threading.Dispatcher.Dispatch(DispatcherPriority priority)
at System.Windows.Threading.Dispatcher.OnInvoke(Object context)
at System.Windows.Hosting.CallbackCookie.Invoke(Object[] args)
at System.Windows.Hosting.DelegateWrapper.InternalInvoke(Object[] args)
at System.Windows.RuntimeHost.ManagedHost.InvokeDelegate(IntPtr pHandle, Int32 nParamCount, ScriptParam[] pParams, ScriptParam& pResult)


Viewing all articles
Browse latest Browse all 801

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>