You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 25, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Feb 25, 2026. It is now read-only.
Please add a click event for row in datagrid.
The selection changed event does not work when is necessary to open a new page.
Because to select the same row is necessary select another row and then re-select the previous row.
A RowPressed and ColumnHeaderPressed event would be very useful for the DataGrid. I need both of these and it's requiring some ugly hacks to get this functionality.
RowPressed should allow detection of both Left and Right mouse button for context menus. DoublePressed would be a bonus.
ColumnHeaderPressed should also allow Left and Right press for context menus. Not sure how to prioritize Left press over Sorting event.
There are many standard use cases that SelectionChanged doesn't support. For example: right click of a row in the table to show a context menu. Also double clicking a row to open it up in an editor. SelectionChanged is conceptually different and has different use cases than a Pressed/Click event. I think ListViewBase supports ItemClick for reference.
Right now I have to implement something like what is below. Usable but it should be out-of-the-box functionality of the DataGrid in my opinion.
private void DataGrid_PointerPressed(object sender, PointerRoutedEventArgs e)
{
PointerPoint point = e.GetCurrentPoint(sender as UIElement);
// Determine the pressed row by navigating the VisualTree (a helper method does this)
DataGridRow pressedRow = UIUtilities.FindParent<DataGridRow>(e.OriginalSource as DependencyObject);
if (point.Properties.IsRightButtonPressed)
{
// Context menu
}
else
{
// Do something like track double press and then open a row in an editor
}
return;
}
There is then a lot of additional code to track double press and get the index of the DataGridRow and correlate it back into the ItemsSource element so it can be selected, etc.
All of this said, ColumnHeaderPressed is even more useful to implement filtering Flyouts and other controls to edit the columns. I still haven't found a good way to do this one.
Glad to see that some attention is being paid to this. ;)
In the application I'm building, users currently have to manually select the row before right-clicking in order to display the row-appropriate context menu. Otherwise, it just displays the column header context menu. I think it would be more user-friendly to have a RowRightTapped which autoselects the nearest row and fires (all on rightclick).
@harinikmsft , @nmetulev Why are issues like this being automatically closed? I understand wanting to avoid permanently open items but these types of things must not just be shutdown automatically. Please change the system from auto-closing these and please reopen this issue.
ghost locked as resolved and limited conversation to collaborators on Nov 26, 2019
Activity
kbrons commentedon Aug 10, 2018
Hi @Kath118, can you create a uservoice request for the issue and add it to your comment?
Thanks!
Kath118 commentedon Aug 10, 2018
@kbrons Hi
Link: https://wpdev.uservoice.com/forums/110705-universal-windows-platform/suggestions/35081719-add-click-event-for-row-datagrid
robloo commentedon Oct 30, 2018
A RowPressed and ColumnHeaderPressed event would be very useful for the DataGrid. I need both of these and it's requiring some ugly hacks to get this functionality.
RowPressed should allow detection of both Left and Right mouse button for context menus. DoublePressed would be a bonus.
ColumnHeaderPressed should also allow Left and Right press for context menus. Not sure how to prioritize Left press over Sorting event.
skendrot commentedon Oct 30, 2018
How would this be different from the SelectionChanged event?
robloo commentedon Nov 1, 2018
There are many standard use cases that SelectionChanged doesn't support. For example: right click of a row in the table to show a context menu. Also double clicking a row to open it up in an editor. SelectionChanged is conceptually different and has different use cases than a Pressed/Click event. I think ListViewBase supports ItemClick for reference.
Right now I have to implement something like what is below. Usable but it should be out-of-the-box functionality of the DataGrid in my opinion.
There is then a lot of additional code to track double press and get the index of the DataGridRow and correlate it back into the ItemsSource element so it can be selected, etc.
All of this said, ColumnHeaderPressed is even more useful to implement filtering Flyouts and other controls to edit the columns. I still haven't found a good way to do this one.
robloo commentedon Nov 18, 2018
Duplicate of #2249
lukeblevins commentedon Nov 18, 2018
Glad to see that some attention is being paid to this. ;)
In the application I'm building, users currently have to manually select the row before right-clicking in order to display the row-appropriate context menu. Otherwise, it just displays the column header context menu. I think it would be more user-friendly to have a RowRightTapped which autoselects the nearest row and fires (all on rightclick).
windowstoolkitbot commentedon Jan 17, 2019
This issue seems inactive. It will automatically be closed in 14 days if there is no activity.
windowstoolkitbot commentedon Jan 25, 2019
This issue seems inactive. It will automatically be closed in 14 days if there is no activity.
windowstoolkitbot commentedon Feb 2, 2019
This issue seems inactive. It will automatically be closed in 14 days if there is no activity.
windowstoolkitbot commentedon Feb 10, 2019
Issue is inactive. It was automatically closed.
robloo commentedon Feb 10, 2019
@harinikmsft , @nmetulev Why are issues like this being automatically closed? I understand wanting to avoid permanently open items but these types of things must not just be shutdown automatically. Please change the system from auto-closing these and please reopen this issue.