Is it possible to manage mouse double-click on a row of SfDataGrid ?

Hi,

I have a readonly SfDataGrid and I'd like to have an event (or something like that) that is called when the user double-clicks with mouse on a cell on the SfDatagrid.
In this event I'd like to know the particular cell and row that the user has double-clicked.
I'm not able to find any solution to obtain such a functionality.
Can anybody help me ?

1 Reply

JG Jai Ganesh S Syncfusion Team April 12, 2018 06:34 AM UTC

Hi Silvio, 
 
You can achieve your requirement to get the row and column index when you double-clicked on SfDataGrid by using the below code, 
 
void syncgrid_MouseDoubleClick(object sender, MouseButtonEventArgs e) 
{ 
    var rowControl = this.FindDescendant(e.OriginalSource, typeof(VirtualizingCellsControl)) as VirtualizingCellsControl; 
    if (rowControl != null) 
    { 
        var visualcontainer = this.syncgrid.GetVisualContainer(); 
        // get the row and column index based on the pointer position  
        var rowColumnIndex = visualcontainer.PointToCellRowColumnIndex(e.GetPosition(visualcontainer)); 
                
        var colindex = this.syncgrid.ResolveToGridVisibleColumnIndex(rowColumnIndex.ColumnIndex); 
 
        MessageBox.Show("RowIndex:" + rowColumnIndex.RowIndex.ToString() + "," + "ColumnIndex:" + colindex.ToString()); 
    }       
} 
 
 
You can also get the cell value for double clicking the datagrid by refer the below KB article, 
 
 
Regards, 
Jai Ganesh S

Loader.
Up arrow icon