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

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

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -