Changing ItemSource/GroupDesc/SortDesc/ItemTemplate causing Exceptions

Thread is closed for posting
5 posts, 0 answers
  1. Warren
    Warren avatar
    9 posts
    Member since:
    Mar 2011

    Posted 12 May 2011 Link to this post

    When I open a new page and initialize a RadJumpList everything works.
    With the first list of content working and when changing a setting (through an applicationbar menu item) and then refresh the content It throws an application exception.

    The idea is that the jumplist displays items using a particular ItemTemplate, GroupDescriptors, SortDescriptors and ItemSource based on a application setting.  The real difference is just the itemtemplate and itemsource data with one having more details then the other.

    Everything works if I always change the setting at the main page before navigating to a new page.  Which a user should not have to do when changing the setting.

    Private Sub GetServices(serviceList As Object)
        RadJumpList.IsAsyncBalanceEnabled = True
        If appSettings.GetServicesSlimSetting Then
            radJumpList.ItemTemplate = ItemTemplateSlim
            serviceList = CType(serviceList, List(Of ServiceInfoSlim))
            Dim groupByServer As New GenericGroupDescriptor(Of ServiceInfoSlim, String)(Function(server) server.Server)
            Dim sortByService As New GenericSortDescriptor(Of ServiceInfoSlim, String)(Function(server) server.Caption)
            radJumpList.ItemTemplate = ItemTemplate
            serviceList = CType(serviceList, List(Of ServiceInfo))
            Dim groupByServer As New GenericGroupDescriptor(Of ServiceInfo, String)(Function(server) server.Server)
            Dim sortByService As New GenericSortDescriptor(Of ServiceInfo, String)(Function(server) server.Caption)
        End If
        radJumpList.ItemsSource = serviceList
    End Sub

    The exception is always thrown as the GroupDescriptors.Add

       at System.Linq.Enumerable.<CastIterator>d__b0`1.MoveNext()
       at System.Linq.Lookup`2.Create[TSource](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer)
       at System.Linq.GroupedEnumerable`4.GetEnumerator()
       at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
       at System.Linq.OrderedEnumerable`1.<GetEnumerator>d__0.MoveNext()
       at Telerik.Windows.Data.DataGroup.InitItems(IEnumerable items)
       at Telerik.Windows.Data.DataGroup.set_Items(IEnumerable value)
       at Telerik.Windows.Data.GroupProcessor.ProcessDataGroups(IDescriptorProcessor descriptor, IEnumerable data)
       at Telerik.Windows.Data.GroupProcessor.ProcessDescriptor(IDescriptorProcessor descriptor, Int32 level, IEnumerable data)
       at Telerik.Windows.Data.GroupProcessor.ProcessCore(IEnumerable data)
       at Telerik.Windows.Data.DescriptorProcessor.Process(IEnumerable data)
       at Telerik.Windows.Data.RadCollectionView.CreateView()
       at Telerik.Windows.Data.RadCollectionView.RefreshOverride()
       at Telerik.Windows.Data.RadCollectionView.Refresh()
       at Telerik.Windows.Data.RadCollectionView.OnResumed(Boolean update)
       at Telerik.Windows.Controls.SuspendableObject.Resume(Boolean update)
       at Telerik.Windows.Data.RadCollectionViewSource.RefreshOverride()
       at Telerik.Windows.Data.RadListSource.Refresh()
       at Telerik.Windows.Data.RadCollectionViewSource.OnGroupDescriptorsChanged(Object sender, NotifyCollectionChangedEventArgs e)
       at System.Collections.ObjectModel.ObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
       at System.Collections.ObjectModel.ObservableCollection`1.InsertItem(Int32 index, DataDescriptor item)
       at System.Collections.ObjectModel.Collection`1.Add(DataDescriptor item)
       at TSOL.WCF.Client.ServicesPage.GetServices(Object serviceList)
       at TSOL.WCF.Client.ServicesPage.GetServicesCompleted(Object sender, GetServicesCompletedEventArgs e)
       at TSOL.WCF.Client.ServiceReference.WMIServiceClient.OnGetServicesCompleted(Object state)
       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)

  2. Victor
    Victor avatar
    1358 posts

    Posted 17 May 2011 Link to this post

    Hello Warren,

     Thank you for writing.
    You first have to assign the new ItemsSource and then add new group descriptors. What is happening is that you have a list of ServiceInfos but are giving the jump list a GroupDescriptor of ServiceInfoSlim. Since you can not cast from ServiceInfoSlim to ServiceInfo the binding logic fails. Just move the assignment of the ItemsSource property before your If statement.

    Please write again if you have other questions.

    Best wishes,
    the Telerik team
    Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
  3. Rajasekar
    Rajasekar avatar
    6 posts
    Member since:
    Nov 2008

    Posted 15 Jun 2012 Link to this post


    Is this issue resolved? When i try to assign a collection to ItemSource property of RadJumpList multiple times, it seems to be showing wrong results (or cached?). However setting the value to null and then assigning the new collection seems to work, but flickers a bit. Is this the only solution, please let know.
  4. Deyan
    Deyan avatar
    2147 posts

    Posted 20 Jun 2012 Link to this post

    Hello Rajasekar,

    The issue that you report does not seem to be related to the issue discussed in the previous posts on this thread and we are currently not aware of similar problems.

    Since we are using similar scenarios in our Demos app and do not experience any issues I believe that you might have some specific code on your side that causes this. Can you please share with us some further details like code snippets or a functional demo app that we can use to reproduce the case here? Please note that you will have to open a new support ticket in order to be able to attach your project.

    Thanks for your time.

    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  5. Rajasekar
    Rajasekar avatar
    6 posts
    Member since:
    Nov 2008

    Posted 21 Jun 2012 Link to this post

    Hi Deyan,

    Apologize that this is not the thread. I will post sample code as well as problem in another new thread. Thank you for the update.
Back to Top