RadJumpList.ItemsSource

4 posts, 0 answers
  1. Paras
    Paras avatar
    11 posts
    Member since:
    May 2011

    Posted 31 Jul 2013 Link to this post

    I have a RadJumpList control on my page in a WP7.x application. The ItemTemplate for this control is set to a complex structure like below:

    <telerikDataControls:RadJumpList.ItemTemplate>
     <DataTemplate>
      <Grid>
       <Image Name="img1" />
       <TextBlock Name="tbVal1" />
       <TextBlock Name="tbVal2" />
       <TextBlock Name="tbVal3" />
      </Grid>
     </DataTemplate>
    </telerikDataControls:RadJumpList.ItemTemplate>

    From what I can tell the RadJumpList.ItemsSource property can only be set to a List<string>. How do I accomplish the task of assigning a value for all the controls in the ItemTemplate while limited to List<string> only? I was hoping to assign a List<MyClass> to the ItemsSource property where 'MyClass' contains elements/properties for all the controls in the ItemTemplate.
     

    Regards,

    Paras Wadehra

    Nokia Developer Ambassador

    INETA Community Champion

    Twitter: @ParasWadehra

    FB: FB.com/WindowsPhoneDeveloper

    My WP Apps

     
  2. Kiril Stanoev
    Admin
    Kiril Stanoev avatar
    1512 posts

    Posted 31 Jul 2013 Link to this post

    Hi Paras,

    The ItemsSource property of the RadJumpList can be set to a collection of any type of object. Please refer to the attached project and let me know if it helps. I'd be glad to assist you further. 

    Regards,
    Kiril Stanoev
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINDOWS PHONE 7.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  3. DevCraft banner
  4. Paras
    Paras avatar
    11 posts
    Member since:
    May 2011

    Posted 03 Aug 2013 Link to this post

    Hi Kiril,

    While your sample solution works, my project still throws an error like:

    System.InvalidCastException was unhandled by user code
      HResult=-2147467262
      Message=Unable to cast object of type 'Namespace.Class' to type 'System.String'.
      Source=System.Core
      StackTrace:
           at System.Linq.Enumerable.<CastIterator>d__b1`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.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.RadListSource.AttachData(IEnumerable data)
           at Telerik.Windows.Data.RadListSource.SetSource(IEnumerable value)
           at Telerik.Windows.Data.RadListSource.set_SourceCollection(IEnumerable value)
           at Telerik.Windows.Controls.RadDataBoundListBox.OnItemsSourceChanged(IEnumerable oldSource)
           at Telerik.Windows.Controls.Primitives.DataControlBase.OnItemsSourceChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
           at System.Windows.DependencyObject.RaisePropertyChangeNotifications(DependencyProperty dp, Object oldValue, Object newValue)
           at System.Windows.DependencyObject.UpdateEffectiveValue(DependencyProperty property, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, ValueOperation operation)
           at System.Windows.DependencyObject.SetValueInternal(DependencyProperty dp, Object value, Boolean allowReadOnlySet)
           at System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value)
           at Telerik.Windows.Controls.Primitives.DataControlBase.set_ItemsSource(IEnumerable value)
           at System.Net.WebClient.OnOpenReadCompleted(OpenReadCompletedEventArgs e)
           at System.Net.WebClient.OpenReadOperationCompleted(Object arg)
      InnerException:

    Any ideas?
  5. Paras
    Paras avatar
    11 posts
    Member since:
    May 2011

    Posted 03 Aug 2013 Link to this post

    Lance McCarthy helped me with this issue offline. A big thanks to him!
Back to Top