Spread WPF Documentation
GrapeCity.Windows.SpreadSheet.UI Namespace / GcSpreadSheet Class / DragDropBlock Event
Example


In This Topic
    DragDropBlock Event (GcSpreadSheet)
    In This Topic
    Occurs when the user drags and drops a range of cells.
    Syntax
    'Declaration
     
    Public Event DragDropBlock As EventHandler(Of DragDropBlockEventArgs)
    'Usage
     
    Dim instance As GcSpreadSheet
    Dim handler As EventHandler(Of DragDropBlockEventArgs)
     
    AddHandler instance.DragDropBlock, handler
    public event EventHandler<DragDropBlockEventArgs> DragDropBlock
    Event Data

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

    PropertyDescription
    (Inherited from System.ComponentModel.CancelEventArgs)
    Gets the column count of the cell range being dragged.  
    Gets whether the source range is copied.  
    Gets the CopyOption value for the drag and drop operation.  
    Gets the column index of the top left cell of the source range (range being dragged).  
    Gets the row index of the top left cell of the source range (range being dragged).  
    Gets whether the source range is inserted.  
    Gets the row count of the cell range being dragged.  
    Gets the column index of the bottom right cell of the destination range (where selection is dropped).  
    Gets the row index of the top left cell of the destination range (where selection is dropped).  
    Example
    This example uses the DragDropBlock event.
    gcSpreadSheet1.DragDropBlock += new EventHandler<DragDropBlockEventArgs>(gcSpread1_DragDropBlock);
     gcSpreadSheet1.DragDropBlockCompleted += new EventHandler<DragDropBlockCompletedEventArgs>(gcSpread1_DragDropBlockCompleted);
    
     void gcSpread1_DragDropBlock(object sender, DragDropBlockEventArgs e)
     {
           if (e.ToRow > 10 || e.ToColumn > 10)
               e.Cancel = true; 
     }
    
     void gcSpread1_DragDropBlockCompleted(object sender, DragDropBlockCompletedEventArgs e)
      {
           if (e.Copy == true && e.Insert == true)
               MessageBox.Show("Copied insert action has been completed");                     
      }
    Private Sub GcSpreadSheet1_DragDropBlock(sender As System.Object, e As GrapeCity.Windows.SpreadSheet.UI.DragDropBlockEventArgs)
            If (e.ToRow > 10 Or e.ToColumn > 10) Then
                e.Cancel = True
            End If
        End Sub
    
        Private Sub GcSpreadSheet1_DragDropBlockCompleted(sender As System.Object, e As GrapeCity.Windows.SpreadSheet.UI.DragDropBlockCompletedEventArgs)
            If (e.Copy = True And e.Insert = True) Then
                MessageBox.Show("Copied insert action has been completed")
            End If
        End Sub
    See Also