Skip to main content

TreeList.ClipboardNodePasting Event

Fires before a node is pasted to the control. Allows you to apply a format, update the pasted data, or skip a data row.

Namespace: DevExpress.XtraTreeList

Assembly: DevExpress.XtraTreeList.v24.1.dll

NuGet Packages: DevExpress.Win.Navigation, DevExpress.Win.TreeList

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.
DataRowCount Gets the count of rows that contain data to process (without column and band header rows).
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.
RowCount Gets the total count of rows to process (with column and band header rows).
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.
IsKeyFieldValueValid() Returns whether the key of the processed node is unique.
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

The TreeList fires the ClipboardNodePasting event before a node is pasted to the control from the clipboard. If the clipboard contains multiple nodes, the event fires for each node. Handle this event to modify data or to cancel pasting the processed row.

A node is not pasted to the control if any of its columns cannot accept data being pasted. For example, if data types do not match. You can set the PasteMode event argument to Force to forcibly paste the node.

Use the IsValueValid and IsNodeValid methods to check if a particular value or the entire node is valid.

Read the following topic for detailed information: Clipboard.

Note

The ClipboardNodePasting event fires if the PasteMode property is set to PasteMode.Append or PasteMode.Update.

See Also