Skip to main content
All docs
V25.1
  • TreeViewControl.ClipboardNodeCopying Event

    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.1.dll

    NuGet Package: DevExpress.Wpf.Grid.Core

    Declaration

    public event EventHandler<ClipboardRowCopyingEventArgs> ClipboardNodeCopying

    Event Data

    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.

    Remarks

    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;
                }
            }
    }
    

    For information on how to copy TreeViewControl data to the clipboard, refer to the following DevExpress WPF Grid help topic: Clipboard Management.

    See Also