internal void InsertIndex(int slot)
        {
            _selectedSlotsTable.InsertIndex(slot);
            _oldSelectedSlotsTable.InsertIndex(slot);

            // It's possible that we're inserting an item that was just removed.  If that's the case,
            // and the re-inserted item used to be selected, we want to update the _oldSelectedSlotsTable
            // to include the item's new index within the collection.
            int rowIndex = OwningGrid.RowIndexFromSlot(slot);

            if (rowIndex != -1)
            {
                object insertedItem = OwningGrid.DataConnection.GetDataItem(rowIndex);
                if (insertedItem != null && _oldSelectedItemsCache.Contains(insertedItem))
                {
                    _oldSelectedSlotsTable.AddValue(slot, true);
                }
            }
        }
 internal void SelectSlot(int slot, bool select)
 {
     if (OwningGrid.RowGroupHeadersTable.Contains(slot))
     {
         return;
     }
     if (select)
     {
         if (!_selectedSlotsTable.Contains(slot))
         {
             _selectedItemsCache.Add(OwningGrid.DataConnection.GetDataItem(OwningGrid.RowIndexFromSlot(slot)));
         }
         _selectedSlotsTable.AddValue(slot, true);
     }
     else
     {
         if (_selectedSlotsTable.Contains(slot))
         {
             _selectedItemsCache.Remove(OwningGrid.DataConnection.GetDataItem(OwningGrid.RowIndexFromSlot(slot)));
         }
         _selectedSlotsTable.RemoveValue(slot);
     }
 }