wpf-devexpress-dot-xpf-dot-grid-dot-treeviewcontrol-51a95c72.md
Occurs before a user copies a node to the clipboard. Allows you to apply a format, change the copied data, or skip a node.
Namespace : DevExpress.Xpf.Grid
Assembly : DevExpress.Xpf.Grid.v25.2.dll
NuGet Package : DevExpress.Wpf.Grid.Core
public event EventHandler<ClipboardRowCopyingEventArgs> ClipboardNodeCopying
Public Event ClipboardNodeCopying As EventHandler(Of ClipboardRowCopyingEventArgs)
The ClipboardNodeCopying event's data class is ClipboardRowCopyingEventArgs. The following properties provide information specific to this event:
| Property | Description |
|---|---|
| Cancel | Gets or sets whether to cancel the copy operation. |
| Headers | Gets a collection of column headers or band headers. |
| RowHandle | |
| Type | Gets the processed object’s type (row, column header, band header, group, group summary). |
| Values | Gets a collection of row or group row values. |
The code sample below changes the appearance of nodes.
<dxg:TreeViewControl x:Name="treeview"
SelectionMode="Row"
ClipboardCopyOptions="All"
ClipboardMode="Formatted"
ClipboardNodeCopying="treeview_ClipboardNodeCopying"
... />
private void treeview_ClipboardNodeCopying(object sender, DevExpress.Xpf.Grid.ClipboardRowCopyingEventArgs e) {
if (e.Type == DevExpress.XtraExport.Helpers.ClipboardInfoType.Row)
foreach (var value in e.Values) {
value.BackColor = System.Drawing.Color.Gray;
value.ForeColor = System.Drawing.Color.White;
for (int i = 0; i < treeview.GetNodeByValue(value.OriginalValue).Level; i++) {
value.Value = " " + value.DisplayValue;
}
}
}
Private Sub treeview_ClipboardNodeCopying(ByVal sender As Object, ByVal e As DevExpress.Xpf.Grid.ClipboardRowCopyingEventArgs)
If e.Type = DevExpress.XtraExport.Helpers.ClipboardInfoType.Row Then
For Each value In e.Values
value.BackColor = System.Drawing.Color.Gray
value.ForeColor = System.Drawing.Color.White
For i As Integer = 0 To treeview.GetNodeByValue(value.OriginalValue).Level - 1
value.Value = " " & value.DisplayValue
Next
Next
End If
End Sub
For information on how to copy TreeViewControl data to the clipboard, refer to the following DevExpress WPF Grid help topic: Clipboard Management.
See Also