コード例 #1
0
        private void MoveItems(RadListBox left,
                               RadItemCollection leftCollection,
                               RadListBox right,
                               RadItemCollection rigthCollection,
                               int countItemsToMove)
        {
            if (left.Items.Count == 0)
            {
                return;
            }

            if (left.SelectedItems.Count == 0)
            {
                for (int i = 0; i < countItemsToMove; ++i)
                {
                    RadItem itemToRemove = left.Items[0];
                    left.Items.Remove(itemToRemove);
                    right.Items.Add(itemToRemove);

                    itemToRemove = (RadItem)itemToRemove.Tag;
                    leftCollection.Remove(itemToRemove);
                    if (!rigthCollection.Contains(itemToRemove))
                    {
                        rigthCollection.Add(itemToRemove);
                    }
                }
            }
            else
            {
                for (int i = 0; i < left.SelectedItems.Count; ++i)
                {
                    RadItem itemToRemove = left.SelectedItems[i];
                    left.Items.Remove(itemToRemove);
                    right.Items.Add(itemToRemove);

                    itemToRemove = (RadItem)itemToRemove.Tag;
                    leftCollection.Remove(itemToRemove);
                    if (!rigthCollection.Contains(itemToRemove))
                    {
                        rigthCollection.Add(itemToRemove);
                    }
                }
            }
        }
コード例 #2
0
 private void MoveItems(
     RadListControl left,
     RadItemCollection leftCollection,
     RadListControl right,
     RadItemCollection rigthCollection,
     int countItemsToMove)
 {
     if (left.Items.Count == 0)
     {
         return;
     }
     if (left.SelectedItems.Count == 0)
     {
         for (int index = 0; index < countItemsToMove; ++index)
         {
             RadListDataItem radListDataItem = left.Items[0];
             left.Items.Remove(radListDataItem);
             right.Items.Add(radListDataItem);
             RadItem tag = (RadItem)radListDataItem.Tag;
             leftCollection.Remove(tag);
             if (!rigthCollection.Contains(tag))
             {
                 rigthCollection.Add(tag);
             }
         }
     }
     else
     {
         for (int index = 0; index < left.SelectedItems.Count; ++index)
         {
             RadListDataItem selectedItem = left.SelectedItems[index];
             left.Items.Remove(selectedItem);
             right.Items.Add(selectedItem);
             RadItem tag = (RadItem)selectedItem.Tag;
             leftCollection.Remove(tag);
             if (!rigthCollection.Contains(tag))
             {
                 rigthCollection.Add(tag);
             }
         }
     }
 }