Skip to main content
A newer version of this page is available. .

TreeList.ClipboardNodePasting Event

Repeatedly fires for each pasted row before updating the control, and allows you to modify pasted data and cancel pasting the currently processed row.

Namespace: DevExpress.XtraTreeList

Assembly: DevExpress.XtraTreeList.v18.2.dll

Declaration

[DXCategory("Action")]
public event ClipboardNodePastingEventHandler ClipboardNodePasting

Event Data

The ClipboardNodePasting event's data class is ClipboardNodePastingEventArgs. The following properties provide information specific to this event:

Property Description
Cancel Gets or sets whether the current operation needs to be canceled.
OriginalValues Returns a read-only collection of individual pasted values.
PasteMode Gets or sets whether only valid rows or all rows are pasted to the control.
TreeListNode Depending on the paste mode, returns the parent node relative to which the data is appended, or the updated node.
Values Returns a dictionary that contains “target column - pasted value” pairs. You can modify pasted values in this dictionary to perform custom pasting.

The event data class exposes the following methods:

Method Description
GetInvalidValues() Returns a dictionary that contains invalid column-value pairs. Invalid pairs identify values that cannot be accepted by corresponding columns.
GetValidValues() Returns a dictionary that contains valid column-value pairs. Valid pairs identify values that can be accepted by corresponding columns.
IsNodeValid() Returns whether pasted values can be accepted by target columns. Both the pasted values and target columns are specified by the ClipboardNodePastingEventArgs.Values dictionary.
IsValueValid(TreeListColumn, Object, out Exception) Returns whether the specified value can be pasted to the specified column cell.
IsValueValid(String, Object, out Exception) Returns whether the specified value can be pasted to the column with the specified field name.

Remarks

If pasted data contains multiple rows, the ClipboardNodePasting event fires for each of these rows. It fires before data in the target control is updated and allows you to modify the pasted data and to cancel the pasting of certain rows.

Use the ClipboardNodePastingEventArgs.Values event parameter to access and modify pasted values.

By default, if any value in the pasted row does not match its target column (e.g., the value’s data type cannot be converted to the column’s data type), this row is considered invalid and this row pasting is canceled. The value and row validity can be performed with the ClipboardNodePastingEventArgs.IsValueValid and ClipboardNodePastingEventArgs.IsNodeValid methods. To force invalid row pasting, you can set the ClipboardNodePastingEventArgs.PasteMode event parameter to Force.

Set the Cancel parameter to true to skip the current row during data pasting.

See Clipboard - Copy and Paste Operations. Data Formatting to learn more.

See Also