private void Unbind(Cell cell, bool recycle) { if (cell == null) { throw new ArgumentNullException("cell"); } if (!VirtualizingCellCollection.IsFreeCell(cell)) { m_bindedCells.Remove(cell.FieldName); } else { Debug.Fail("Should always have a field name"); } if (recycle) { // Put the cell into the appropriate recycle bin. var recyclingGroup = this.GetRecyclingGroup(this.GetColumn(cell)); var recycleBin = this.GetRecycleBinOrNew(recyclingGroup); // A released cell shouldn't be in the recycle bin already. Debug.Assert(!recycleBin.Contains(cell)); recycleBin.Add(cell); } else { m_cells.Remove(cell); } }
private void Bind(Cell cell, bool overwrite) { if (cell == null) { throw new ArgumentNullException("cell"); } if (!VirtualizingCellCollection.IsFreeCell(cell)) { string fieldName = cell.FieldName; Cell oldCell; if (m_bindedCells.TryGetValue(fieldName, out oldCell)) { if (cell == oldCell) { return; } if (!overwrite) { this.ThrowCellBinded(fieldName); } this.InternalRemove(oldCell); } m_bindedCells.Add(fieldName, cell); } else { if (m_freeCells == null) { m_freeCells = new List <Cell>(1); } m_freeCells.Add(cell); } m_cells.Add(cell); }