I am using the Windows Community Toolkit WinUI DataGrid control. I would like to run some code when a row is clicked. How can I do that?
I have tried:
SelectionChanged
event: Only works the first time the row is clicked, as after that the same row is being selected. Also gets triggered if the row is moved to via the keyboard.CurrentCellChanged
event: Only works the first time a cell is clicked, as after that clicking the same cell does not change the current cell. (And I could not find a way to clear the current cell programmatically.)- Answers like this show how to add row event handlers via style in WPF, but this does not work in WinUI.
Any ideas?