This question is locked. New answers and comments are not allowed.
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.
The exception is always thrown as the GroupDescriptors.Add
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
radJumpList.GroupDescriptors.Clear()
radJumpList.SortDescriptors.Clear()
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)
radJumpList.GroupDescriptors.Add(groupByServer)
Dim
sortByService
As
New
GenericSortDescriptor(Of ServiceInfoSlim,
String
)(
Function
(server) server.Caption)
radJumpList.SortDescriptors.Add(sortByService)
Else
radJumpList.ItemTemplate = ItemTemplate
serviceList =
CType
(serviceList, List(Of ServiceInfo))
Dim
groupByServer
As
New
GenericGroupDescriptor(Of ServiceInfo,
String
)(
Function
(server) server.Server)
radJumpList.GroupDescriptors.Add(groupByServer)
Dim
sortByService
As
New
GenericSortDescriptor(Of ServiceInfo,
String
)(
Function
(server) server.Caption)
radJumpList.SortDescriptors.Add(sortByService)
End
If
radJumpList.ItemsSource = serviceList
End
Sub
The exception is always thrown as the GroupDescriptors.Add
InvalidCastException
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)