protected virtual void DetachCells()
 {
     while (this.VisualCells.Count > 0)
     {
         GridCellElement visualCell = this.VisualCells[0];
         visualCell.Parent.Children.Remove((RadElement)visualCell);
         GridVirtualizedCellElement virtualizedCellElement = visualCell as GridVirtualizedCellElement;
         if (virtualizedCellElement != null)
         {
             this.TableElement.CellElementProvider.CacheElement((IVirtualizedElement <GridViewColumn>)virtualizedCellElement);
             virtualizedCellElement.Detach();
         }
         else
         {
             visualCell.Dispose();
         }
     }
 }
        protected override void RemoveElement(int position)
        {
            GridVirtualizedCellElement child = this.Children[position] as GridVirtualizedCellElement;

            if (child != null)
            {
                if (child.RowElement == null || child.TableElement == null || (child.GridViewElement == null || child.GridViewElement.EditorManager == null) || !child.GridViewElement.IsInEditMode)
                {
                    base.RemoveElement(position);
                    return;
                }
                IEditableCell editableCell = child as IEditableCell;
                if (editableCell != null && editableCell.Editor != null && editableCell.Editor == child.GridViewElement.EditorManager.ActiveEditor)
                {
                    child.GridViewElement.EditorManager.CancelEdit();
                }
            }
            base.RemoveElement(position);
        }
Exemple #3
0
        private void Detach(
            IVirtualizedElementProvider <GridViewColumn> cellElementProvider,
            GridCellElement cell)
        {
            GridVirtualizedCellElement virtualizedCellElement = cell as GridVirtualizedCellElement;

            if (virtualizedCellElement != null)
            {
                cellElementProvider.CacheElement((IVirtualizedElement <GridViewColumn>)virtualizedCellElement);
                virtualizedCellElement.Detach();
                if (virtualizedCellElement.Parent == null || !virtualizedCellElement.Parent.Children.Contains((RadElement)virtualizedCellElement))
                {
                    return;
                }
                virtualizedCellElement.Parent.Children.Remove((RadElement)virtualizedCellElement);
            }
            else
            {
                cell.Dispose();
            }
        }