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

searchKeyword not working in AngularJS filter -

sequelize.js - Sequelize: sort by enum cases -

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