c# - WPF DataGrid: How to Determine the Current Row Index? -


i trying implement simple spreadsheet functionality based on datagrid.

  1. the user clicks on cell

  2. the user types value , presses return

  3. the current row scanned , cell formula depends on clicked cell updated.

this seems best event handler requirements:

private void my_datagrid_currentcellchanged(object sender, eventargs e) 

question: how detect row index of current row?

try (assuming name of grid "my_datagrid"):

var currentrowindex = my_datagrid.items.indexof(my_datagrid.currentitem); 

normally, you'd able use my_datagrid.selectedindex, seems currentcellchanged event, value of selectedindex displays previously selected index. particular event seems fire before value of selectedindex changes.


Comments

Popular posts from this blog

user interface - how to replace an ongoing process of image capture from another process call over the same ImageLabel in python's GUI TKinter -

javascript - Using jquery append to add option values into a select element not working -

javascript - Restarting Supervisor and effect on FlaskSocketIO -