Xceed Grid for WinForms v4.3 Documentation
Cut and Paste
Welcome to Xceed Grid for WinForms v4.3 > Grid Designer > Cut and Paste

Every element in the grid can be copy/cut and pasted into the same grid or a different grid in the same manner as, for example, copying and pasting a line of text in Notepad.

Pasting

A copied or cut grid element can be pasted back into the same grid at a different location or pasted into another grid. When pasting grid elements, there are a few things you should be aware of:

  • A DataRowStyle will be pasted after all the other DataRowStyles currently in the grid.   

  • When pasting a group, if another group (or one of its rows or cells) is selected, the group will be pasted after the selected group. If anything other than a group (or a row or cell within a group) is selected, the group will pasted before the other groups. 

  • Pasting a cell in a row will replace the cell of the column which has the same field name ( Column.FieldName ). 

  • Pasting over an existing Column will replace the column as well as all of its cells. 

  • Since a grid can only contain one DataRowTemplate, pasting a DataRowTemplate will replace the existing DataRowTemplate even if it is not the currently selected element. 

  • When pasting a row, if another row (or one of its cells) is selected, the row will be added after the currently selected row. If a DataRowStyle, Column or the grid is selected, the row will be added to the grid's footer section. If a group is selected, the row will be added to the group's footer section.

Deleting

Every grid element can be deleted except the DataRowTemplate, cells and columns. Although the Grid Designer permits the delete operation on the DataRowTemplate, cells and columns, in the case of the DataRowTemplate and cells, it will only prevent them from being persisted. 

In the case of databound columns, we were not able to prevent the delete operation. Deleting a databound column will not actually delete the column. At first, the column will appear deleted however when the application is run, the supposedly deleted column will appear at the end of the other columns. When returning to the designer, the column will still be present but at the end of the other columns. In order to prevent a column from being displayed, its Visible property must be set to false. 

It is important to note that when restoring a deleted grid element with "undo", the ambient properties such as BackColor, Font, etc., will no longer be ambient. For example, if you delete a row whose ambient properties have not been modified and therefore have been inherited from its parent, when you restore the deleted row, its once-ambient properties will no longer be ambient. This means that if you change the background color of a grid element's parent, its background color will not change as it would have before it was deleted.