Edit this page

Copying

This article will go through the mechanisms that the control provides for controlling how its content can be copied to the Clipboard.

ClipboardCopyMode

Copying to the Clipboard is controlled by the ClipboardCopyMode property of RadVirtualGrid. It is a Flags Enumeration of type VirtualGridClipboardCopyMode. It has the following values.

  • None: Copying is disabled.

  • Cells: Copy grid cells.

  • SkipEmptyRows: Will not copy rows with values that are all null or empty.

Events

There are two events that allow you to control the copying operation: Copying and CopyingCellClipboardContent. The first allows you to cancel a copying operation, whereas the second event allows you to cancel copying for a single cell or override the value to be copied to the Clipboard.

Example 1: Subscribing to the Copying event

private void VirtualGrid_Copying(object sender, VirtualGridClipboardEventArgs e)
    {
        e.Cancel = true;
    }

Example 2: Subscribing to the CopyingCellClipboardContent event

private void VirtualGrid_CopyingCellClipboardContent(object sender, VirtualGridCellClipboardEventArgs e)
    {
        if (e.Cell.ColumnIndex == 0)
        {
            var item = this.clubsSource.ElementAt(e.Cell.RowIndex);
            e.Value = string.Format("{0} {1}", item.Name, item.StadiumCapacity);
        }
    }

See Also