wpf-devexpress-dot-xpf-dot-grid-dot-gridviewbase-99d2162c.md
Use the CopyingToClipboard event instead
Occurs when grid data is copied to the clipboard, allowing you to manually copy required data.
Namespace : DevExpress.Xpf.Grid
Assembly : DevExpress.Xpf.Grid.v25.2.dll
NuGet Package : DevExpress.Wpf.Grid.Core
[Obsolete("Use the GridControl.CopyingToClipboard event instead")]
[Browsable(false)]
public event CopyingToClipboardEventHandler CopyingToClipboard
<Obsolete("Use the GridControl.CopyingToClipboard event instead")>
<Browsable(False)>
Public Event CopyingToClipboard As CopyingToClipboardEventHandler
The CopyingToClipboard event's data class is CopyingToClipboardEventArgs. The following properties provide information specific to this event:
| Property | Description |
|---|---|
| CopyHeader | Gets whether column headers are copied to the clipboard. Inherited from CopyingToClipboardEventArgsBase. |
| GridCells | 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 RoutedEventArgs. |
| OriginalSource | Gets the original reporting source as determined by pure hit testing, before any possible Source adjustment by a parent class. Inherited from RoutedEventArgs. |
| RoutedEvent | Gets or sets the RoutedEvent associated with this RoutedEventArgs instance. Inherited from RoutedEventArgs. |
| RowHandles | Gets an array of handles that correspond to rows whose values are to be copied to the clipboard. Inherited from CopyingToClipboardEventArgsBase. |
| Source | Gets the View that raised the event. Inherited from CopyingToClipboardEventArgsBase. |
The event data class exposes the following methods:
| Method | Description |
|---|---|
| InvokeEventHandler(Delegate, Object) | 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 RoutedEventArgs. |
| OnSetSource(Object) | 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 RoutedEventArgs. |
Views provide two events that allow you to manually process clipboard operations.
To learn more, see Clipboard Management.
private void grid_CopyingToClipboard(object sender, DevExpress.Xpf.Grid.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;
}
See Also