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 ReleaseCore(Cell cell) { Debug.Assert(!VirtualizingCellCollection.IsFreeCell(cell), "Should always have a field name"); m_bindedCells.Remove(cell.FieldName); switch (this.VirtualizationMode) { case ColumnVirtualizationMode.None: { //Not virtualizing this.InternalRemoveCore(cell); break; } case ColumnVirtualizationMode.Recycling: { // If recycling, 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); break; } case ColumnVirtualizationMode.Virtualizing: { //Virtualizing with no recycling m_unbindedCells.Add(cell.FieldName, cell); break; } } }
private void InternalRemoveCore(Cell cell, bool unbind = false) { Debug.Assert(!VirtualizingCellCollection.IsFreeCell(cell), "Should always have a field name"); if (unbind) { m_bindedCells.Remove(cell.FieldName); } m_cells.Remove(cell); m_parentRow.RemoveFromVisualTree(cell); //This must absolutely be done once every collection has removed the cell, for the ParentColumn will be set to null, thus the FieldName will be lost. cell.CleanUpOnRemove(); }
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); }