c# - WPF DataGrid: How to Determine the Current Row Index? -
i trying implement simple spreadsheet functionality based on datagrid.
the user clicks on cell
the user types value , presses return
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
Post a Comment