Synchronize of Three Jumplist CheckedItems collections

3 posts, 1 answers
  1. Cuneyt
    Cuneyt avatar
    36 posts
    Member since:
    Dec 2011

    Posted 23 Feb 2015 Link to this post

    I have three jumplist ( multiselect with checkbox) in the different pivot item. If i select a few items in first jumplist, then i want to make second and third jumplist selected with first jumplist's checked items. how can we synchronize of these jumplists check items. what is the best solution. Could we bind of these jumplist's SelectedItem to each other.

    Thank you.
        
  2. Cuneyt
    Cuneyt avatar
    36 posts
    Member since:
    Dec 2011

    Posted 23 Feb 2015 Link to this post

    Ok i tried JumpListAZ_ItemCheckedStateChanged event. But threw an InvalidOperationException.
    event is below:
    private void HaraketListJumpListAZ_ItemCheckedStateChanged(object sender, ItemCheckedStateChangedEventArgs e)
           {
               if (e.IsChecked)
               {
                   HaraketListJumpListEkipman.CheckedItems.Add(e.Item);
                   HaraketListJumpListKas.CheckedItems.Add(e.Item);
               }
               else
               {
                   HaraketListJumpListEkipman.CheckedItems.Remove(e.Item);
                   HaraketListJumpListKas.CheckedItems.Remove(e.Item);
               }
                
                
           }


    the error is:

    {System.InvalidOperationException: Item already checked.
       at Telerik.Windows.Controls.CheckedItemsCollection`1.Add(T item)
       at FitnessPivot.HaraketListSelector.HaraketListJumpListAZ_ItemCheckedStateChanged(Object sender, ItemCheckedStateChangedEventArgs e)
       at Telerik.Windows.Controls.RadDataBoundListBox.OnItemCheckedStateChanged(Object item, Boolean isChecked)
       at Telerik.Windows.Controls.CheckedItemsCollection`1.Add(T item)
       at Telerik.Windows.Controls.RadDataBoundListBox.AddCheckedItem(DataSourceItem item)
       at Telerik.Windows.Controls.RadDataBoundListBox.HandleItemCheckStateChange(RadDataBoundListBoxItem item)
       at Telerik.Windows.Controls.RadJumpList.HandleItemCheckStateChange(RadDataBoundListBoxItem item)
       at Telerik.Windows.Controls.RadDataBoundListBox.OnItemTap(RadDataBoundListBoxItem item, UIElement container, UIElement originalSource, Point hitPoint)
       at Telerik.Windows.Controls.RadJumpList.OnItemTap(RadDataBoundListBoxItem item, UIElement container, UIElement originalSource, Point hitPoint)
       at Telerik.Windows.Controls.RadDataBoundListBoxItem.OnTap(UIElement container, UIElement originalSource, Point hitPoint)
       at Telerik.Windows.Controls.RadDataBoundListBoxItem.OnTap(GestureEventArgs e)
       at System.Windows.Controls.Control.OnTap(Control ctrl, EventArgs e)
       at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName)}

    actually there is no item checked. 
  3. DevCraft banner
  4. Answer
    Ivaylo Gergov
    Admin
    Ivaylo Gergov avatar
    661 posts

    Posted 26 Feb 2015 Link to this post

    Hi,

    This is the right approach. The only thing that you should have in mind is that the e.Item object is of type IDataSourceItem which the keeps business item in its Value property. In this case the code should look like this:

    if (e.IsChecked)
               {
                   HaraketListJumpListEkipman.CheckedItems.Add((e.Item as IDataSourceItem).Value);
                   HaraketListJumpListKas.CheckedItems.Add((e.Item as IDataSourceItem).Value);
               }
               else
               {
                   HaraketListJumpListEkipman.CheckedItems.Remove((e.Item as IDataSourceItem).Value);
                   HaraketListJumpListKas.CheckedItems.Remove((e.Item as IDataSourceItem).Value);
               }

    On our end everything works as expected. If this does not help, could you please send a sample project to reproduce the issue.

    Regards,
    Ivaylo Gergov
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
Back to Top