Back to Devexpress

TreeList.ClipboardNodePasting Event

windowsforms-devexpress-dot-xtratreelist-dot-treelist-0b554241.md

latest5.9 KB
Original Source

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.v25.2.dll

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

Declaration

csharp
[DXCategory("Action")]
public event ClipboardNodePastingEventHandler ClipboardNodePasting
vb
<DXCategory("Action")>
Public Event ClipboardNodePasting As ClipboardNodePastingEventHandler

Event Data

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

PropertyDescription
CancelGets or sets whether the current operation needs to be canceled.
DataRowCountGets the count of rows that contain data to process (without column and band header rows).
OriginalValuesReturns a read-only collection of individual pasted values.
PasteModeGets or sets whether only valid rows or all rows are pasted to the control.
RowCountGets the total count of rows to process (with column and band header rows).
TreeListNodeDepending on the paste mode, returns the parent node relative to which the data is appended, or the updated node.
ValuesReturns 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:

MethodDescription
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

PasteMode

PasteFromClipboard()

PasteAsChildNodes

ClipboardNodeCopying

Clipboard

TreeList Class

TreeList Members

DevExpress.XtraTreeList Namespace