We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

CurrentCellActivatedCommand Event - Incorrect Column ID with DetailsView column

Thread ID:





125410 Aug 15,2016 06:52 PM UTC Aug 16,2016 02:17 PM UTC WPF 1
Tags: SfDataGrid
Asked On August 15, 2016 06:52 PM UTC

I am using the CurrentCellActivatedCommand event on the control to detect if a user clicks any of columns 2 to 3 within a 6 column layout.
Within my grid, I have a DetailsViewDefinition and when the application runs, I get the default Expand/Collapse column appear correctly.

The issue is that when I use the above Event and a user clicks the Expand/Collapse button of a row, I get the correct Row returned within the CurrentCellActivatedEventArgs however the column reference is incorrect. It appears to be the last non-expand collapse column that was selected in any other row. e.g. If I click column 5 on Row 2 and then click column 1 (Expand/Collapse column) on Row 10, the CurrentCellActivatedEventArgs shows 10 as the row index (correct) but 5 for the column index (wrong)

Is there some property I need to change to get this to work or would a different Event be better for this? I essentially want some action to occur only if a user clicks in columns 2 or 3 of the grid and not if a user is just clicking the Expand/Collapse button

Many thanks,

Jai Ganesh S [Syncfusion]
Replied On August 16, 2016 02:17 PM UTC

Hi Ross, 
While we click column 5 on Row 2 and then click column 1 (Expand/Collapse column) on Row 10, the current cell moves to column 5 on Row 10 and CurrentCellActivatedEventArgs shows 10 as the row index and 5 for the column index. This is the default behavior of SfDataGrid.  
Screen Shot: 
However, you can do the action if you only clicking a column 2 or 3 by wiring the PreviewMouseUp event like below, 
void dataGrid_PreviewMouseUp(object sender, MouseButtonEventArgs e) 
    var rowcolindex = this.dataGrid.GetVisualContainer().PointToCellRowColumnIndex(e.GetPosition(this.dataGrid.GetVisualContainer())); 
    if(rowcolindex.ColumnIndex == 2 || rowcolindex.ColumnIndex == 3) 
        //Do your actions here 
Jai Ganesh S 


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon