ClipboardRowPastingEventArgs.CellValues Property
In This Article
Gets pasted values.
Namespace: DevExpress.WinUI.Grid
Assembly: DevExpress.WinUI.Grid.v23.2.dll
NuGet Package: DevExpress.WinUI
#Declaration
public Dictionary<ColumnBase, object> CellValues { get; }
#Property Value
Type | Description |
---|---|
Dictionary<Column |
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:
<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