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

ClipboardRowPastingEventArgs.CellValues Property

Gets pasted values.

Namespace: DevExpress.WinUI.Grid

Assembly: DevExpress.WinUI.Grid.v22.1.dll

NuGet Package: DevExpress.WinUI

Declaration

public Dictionary<ColumnBase, object> CellValues { get; }

Property Value

Type Description
Dictionary<ColumnBase, Object>

Pasted values.

Example

The GridControl raises the ClipboardRowPasting event for each pasted row. You can use this event to change pasted values or exclude a row from the result.

The following code sample handles the event to replace the Yes and No string values pasted into the Discounted column cells with Boolean values:

WinUI Grid - ClipboardRowPasting Event

<dxg:GridControl ...
                 x:Name="grid" 
                 PasteMode="Append"
                 ClipboardRowPasting="grid_ClipboardRowPasting">
    <!-- ... -->
</dxg:GridControl>
void grid_ClipboardRowPasting(object sender, DevExpress.WinUI.Grid.ClipboardRowPastingEventArgs e) {
    var discColumn = grid.Columns["Discounted"];
    // Check if a user pastes any data in the Discounted column:
    if (e.CellValues.ContainsKey(discColumn)) {
        // Check if the pasted value does not match the column's type:
        if (!e.IsRowValueValid(discColumn, e.CellValues[discColumn], out Exception exception)) { 
            if (Equals(e.CellValues[discColumn], "Yes")) 
                e.CellValues[discColumn] = true;
            else if (Equals(e.CellValues[discColumn], "No")) 
                e.CellValues[discColumn] = false;
            else throw exception;
        }
    }
}
See Also