GridControl.CopyingToClipboard Event
Occurs when grid data is copied to the clipboard. It allows you to manually copy required data.
Namespace: DevExpress.Xpf.Grid
Assembly: DevExpress.Xpf.Grid.v24.2.dll
NuGet Package: DevExpress.Wpf.Grid.Core
#Declaration
public event CopyingToClipboardEventHandler CopyingToClipboard
#Event Data
The CopyingToClipboard event's data class is CopyingToClipboardEventArgs. The following properties provide information specific to this event:
Property | Description |
---|---|
Copy |
Gets whether column headers are copied to the clipboard.
Inherited from Copying |
Grid |
Gets an array of cells whose values are about to be copied to the clipboard. |
Handled |
Gets or sets a value that indicates the present state of the event handling for a routed event as it travels the route.
Inherited from Routed |
Original |
Gets the original reporting source as determined by pure hit testing, before any possible Source adjustment by a parent class.
Inherited from Routed |
Routed |
Gets or sets the Routed |
Row |
Gets an array of handles that correspond to rows whose values are to be copied to the clipboard.
Inherited from Copying |
Source |
Gets the View that raised the event.
Inherited from Copying |
The event data class exposes the following methods:
Method | Description |
---|---|
Invoke |
When overridden in a derived class, provides a way to invoke event handlers in a type-specific way, which can increase efficiency over the base implementation.
Inherited from Routed |
On |
When overridden in a derived class, provides a notification callback entry point whenever the value of the Source property of an instance changes.
Inherited from Routed |
#Remarks
The GridControl provides the GridControl.CopyingToClipboard
event that allows you to process copy operations manually. This event is raised before row values are copied to the clipboard by an end user or in code.
The following code sample demonstrates how to process data that is copied to the clipboard:
<dxg:GridControl CopyingToClipboard="OnCopyingToClipboard" />
void OnCopyingToClipboard(object sender, CopyingToClipboardEventArgs e) {
Clipboard.Clear();
// You should manually implement the GetRowData() method
// that returns data to be copied to the clipboard.
Clipboard.SetData(DataFormats.Text, GetRowData());
e.Handled = true;
}
Note
- The
Grid
event is raised only if the GridControl. Copying To Clipboard Control does not have an active cell editor. Use the DataView property to detect whether the GridBase. Active Editor Control contains an active cell editor. - The
Grid
event is not raised if the DataControl. Copying To Clipboard Control property is set to ClipboardBase. Clipboard Copy Mode Copy .Mode. None
Tip
Views provide two events that allow you to manually process clipboard operations.
- The Copying
To event is fired before row/cell values are copied to the clipboard by an end user, or in code. To cancel default processing, set the event parameter’s Handled property to true. This event isn’t fired if the DataClipboard Control property is set to ClipboardBase. Clipboard Copy Mode Copy .Mode. None - The Data
Control event is fired after an end user has pressedBase. Pasting From Clipboard Ctrl
+V
orShift
+Ins
.