2

I want to be able to toggle selection when a row is clicked. So, first click should highlight it and second click (again on the row) should unhighlight it (and fire an event). Is it even possible? I'm using a OnSelectionChanged event but that gets fired only when I click on a different row than the selected one.

ashokgelal
  • 80,002
  • 26
  • 71
  • 84
  • You might be able to use the `Click` event and check the selected index to see if it's the selected row that's been clicked. Not sure what you can do after that though.... – ChrisF Oct 31 '11 at 23:26
  • I tried with 'Click' already. It is way to complicated. Also, it won't work in certain circumstances like if you click anything outside a row, the Click gets fired. Either I've to do a hittesting or something more non-trivial. I think I got an alternative solution that works. Although looks like a bit hacky but I can bear it rather than the ugly click. Will post a solution once I'm convinced that it works as expected. Thanks though. – ashokgelal Nov 01 '11 at 06:51

1 Answers1

2

there a some useful answers here(searching the visual tree) or here(check in PreviewMouseLeftButtonDown).

Community
  • 1
  • 1
blindmeis
  • 22,175
  • 7
  • 55
  • 74