Version

ClipboardCopyingItem Event

This event is raised prior to each selected cell being copied to the clipboard.
Syntax
'Declaration
 
Public Event ClipboardCopyingItem As EventHandler(Of ClipboardCopyingItemEventArgs)
public event EventHandler<ClipboardCopyingItemEventArgs> ClipboardCopyingItem
Event Data

The event handler receives an argument of type ClipboardCopyingItemEventArgs containing data related to this event. The following ClipboardCopyingItemEventArgs properties provide information specific to this event.

PropertyDescription
Cancel (Inherited from Infragistics.CancellableEventArgs) 
Cell Gets the cell being copied to the clipboard.
ClipboardValue Gets or sets the Value of the cell being copied to the clipboard.
Example
This sample demonstrates the ClipboardCopyingItem event which is fired for every selected cell before being copied to the clipboard regardless of the value of the copyType property.

For an overview of how to handle events in Visual Basic or Visual C#, see Event Handlers in Visual Basic and Visual C#. For specific information and code examples illustrating how to consume events in your application, see Consuming Events in the .NET Framework Developer's Guide.

Private Sub xamGrid_ClipboardCopyingItem(ByVal sender As Object, ByVal e As ClipboardCopyingItemEventArgs)
' Get the reference to the cell that will be copied
Dim selectedCell As CellBase = e.Cell
 
' The headers cells style will not be changed
If selectedCell.Row.RowType <>  RowType.HeaderRow Then
' Add verification for valid data in a data cell.
' In this case, the negative values cells in UnitsOnOrder columnwill not be copied.    If selectedCell.Column.Key.Equals("UnitsOnOrder") 
        AndAlso Convert.ToInt32(e.Cell.Value) <= 0 Then
            e.Cancel = True
            Return
    End If
    ' Set the new style to the cells that will be copied
    selectedCell.Style = TryCast(Me.Resources("grayCellStyle"), Style)
    End If
End Sub
void xamGrid_ClipboardCopyingItem(object sender, ClipboardCopyingItemEventArgs e)
{
    // Get the reference to the cell that will be copied
    CellBase selectedCell = e.Cell;
 
    // The headers cells style will not be changed
    if (selectedCell.Row.RowType != RowType.HeaderRow)
    {
    // Add verification for valid data in a data cell.
    // In this case, the negative values cells in UnitsOnOrder column will not be copied.        if (selectedCell.Column.Key.Equals("UnitsOnOrder") 
             && Convert.ToInt32(e.Cell.Value) <= 0)
        {
            e.Cancel = true;
            return;
        }
        // Set the new style to the cells that will be copied
        selectedCell.Style = this.Resources["grayCellStyle"] as Style;
     }
}
<ig:XamGrid x:Name="xamGrid" 
    
ClipboardCopyingItem="xamGrid_ClipboardCopyingItem">
</ig:XamGrid>
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also