Version

ClipboardCopying Event

This event is raised prior to selected cells or rows being copied to the clipboard.
Syntax
'Declaration
 
Public Event ClipboardCopying As EventHandler(Of ClipboardCopyingEventArgs)
public event EventHandler<ClipboardCopyingEventArgs> ClipboardCopying
Event Data

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

PropertyDescription
Cancel (Inherited from Infragistics.CancellableEventArgs) 
ClipboardValue Gets or sets the text being copied to the clipboard.
SelectedItems The selected cells that will be copied to the clipboard.
Example
This sample demonstrates how to handle the ClipboardCopying event which is fired the moment right before the selected cells or rows are copied to the clipboard.

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_ClipboardCopying(ByVal sender As Object,
 ByVal e As ClipboardCopyingEventArgs)
    Dim headerCells As Integer = 0
    Dim dataCells As Integer = 0
 
    For Each cell In e.SelectedItems
        If cell.Row.RowType.Equals(RowType.HeaderRow) Then
            headerCells += 1
        End If
        If cell.Row.RowType.Equals(RowType.DataRow) Then
            dataCells += 1
        End If
    Next
    System.Diagnostics.Debug.WriteLine("The total number of cells being copied:" & Convert.ToString(e.SelectedItems.Count))
    System.Diagnostics.Debug.WriteLine("The number of header cells being copied: " & headerCells)
    System.Diagnostics.Debug.WriteLine("The number of data cells being copied: " & dataCells)
End Sub
void xamGrid_ClipboardCopying(object sender, ClipboardCopyingEventArgs e)
{
    int headerCells = 0;
    int dataCells = 0;
 
    foreach (var cell in e.SelectedItems)
    {
        if (cell.Row.RowType.Equals(RowType.HeaderRow))
            headerCells++;
        if (cell.Row.RowType.Equals(RowType.DataRow))
            dataCells++;
    }
 
    System.Diagnostics.Debug.WriteLine("The total number of cells being copied:" + e.SelectedItems.Count);
    System.Diagnostics.Debug.WriteLine("The number of header cells being copied:" + headerCells);
    System.Diagnostics.Debug.WriteLine("The number of data cells being copied:" + dataCells);
}
<ig:XamGrid x:Name="xamGrid" 
    
ClipboardCopying="xamGrid_ClipboardCopying">
</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