I have a WPF DataGrid and have a event MouseRightButtonUp for right click on DataGrid. How to access DataGridCell inside the event handler?
private void DataGrid_MouseRightButtonUp(object sender, MouseButtonEventArgs e)
{
//access DataGridCell on which mouse is right clicked
//Want to access cell here
}
I never really like using the visual tree helper for some reason but in cases like this it can be used.
Basically what it does is hit test the control under the mouse as the right button is clicked and use the visual tree helper class to navigate up the visual tree until you hit a cell object.