Copies the selected record(s) to the Clipboard as text.
The CopyToClipboard method copies the selected records to the Clipboard as text. Only the contents of the visible columns are copied. For group rows, this method copies only the values of the grouping columns. Records hidden under the collapsed group rows aren't included.
If the GridOptionsBehavior.CopyToClipboardWithColumnHeaders option is enabled, the CopyToClipboard method also copies the column captions to the Clipboard.
Records in the Clipboard are separated by the newline strings ("\r\n"). The TAB character ("\t") is used to separate the values within a record.
The currently selected record(s) can be accessed via the ColumnView.GetSelectedRows method.
The CopyToClipboard method is automatically called when the CTRL+C shortcut is pressed while a View is focused.
If the GridOptionsSelection.MultiSelectMode property equals CellSelect, the CopyToClipboard method copies data only from selected cells.
Copying a large amount of data to the Clipboard can cause an exception if there are limited memory resources. To limit the number or rows when copying to the Clipboard, use the BaseView.MaxRowCopyCount property. If this property is set to -1 (the default value), all the selected records are copied to the Clipboard. Otherwise, the BaseView.MaxRowCopyCount property limits the number of records to be copied.
Detail pattern Views do not contain data and they are never displayed within XtraGrid. So, the CopyToClipboard member must not be invoked for these Views. The CopyToClipboard member can only be used with real Views that are displayed within the Grid Control. The real Views with which an end-user interacts at runtime can be accessed using the following methods.
- GridControl.MainView - returns the top most View in a grid;
- GridControl.FocusedView - returns the focused View;
- GridControl.DefaultView - returns the currently maximized View;
- the sender parameter of View specific events;
- GridView.GetDetailView - returns a detail clone View for a specific master row.