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