c# - How to change ordering of 'CurrentCellChanged' and 'SelectedCellsChanged' effects? -


when selecting new cell on new row in wpf datagrid, seems done through 2 sequential events take path "a" in figure below. these following events:

  1. currentcellchanged (for shifting selection within current row)
  2. selectedcellschanged (for shifting selection of rows)

diagram of paths selected cell take final selection

due background actions have going on datagrid , bound datatable, need able mimic taking path "b". can't find other events triggered when clicking next cell allow me this.

does have idea here?

i have 1 idea should work, seems hack , imagine there must better way works datagrid , not around it.

additional info

i doing sort of independent row-by-row cell selection marker, use currentcellchanged perform action if user changes selection within row cell meets criteria. however, if selection on different column of row, action still first performed on deselected row, , again on newly selected row once selectedcellschanged occurs.

if path "b" taken, setup work correctly.

for i'm using following method avoid problem:

  1. when currentcellchanged event causes change in markers on row, private boolean property of form set record 'true' changed event, , before & after values 1 of changes recorded.
  2. if selectedcellschanged event occurs, routine checks boolean flag. if indicates change, actions in currentcellchanged reversed appropriate row using recorded data before action done in selectedcellschanged. since far can tell selectedcellschanged never occurs alone , follows currentcellchanged, method should reliable (famous last words).

sorry lack of code, seems me drawing , event names should suffice describing strategy need! if code samples help, can provide if indicate need see.


Comments