Hi
I am having some problems with selection in the DataGrid control. The main problem is that DataRow.IsSelected is read-only, so I am not able to affect selection in the same way I could using the WPF ListView. I basically want to synchronize my viewModels IsSelected with the DataRow.IsSelected. I've been able to work around this.
My next issue is that in my DataRows, I would like to have an expander, and the selection should follow these rules:
- The row can be selected/deselected without affecting the expander.
- A selected row can be expanded/collapsed by clicking the toggle button.
- A deselected row should NOT be expanded
- Clicking the togglebutton of the expander should select the row
My predicament is that I am unable to click the toggle button and select the row at the same time. I have tried using attached behavior to select the row when the toggleButton is clicked, but that leads to other problems such as existing bindings to the ToggleButton are not updated properly, or that when adding the item to selection, the togglebutton reverts to not being selected (seems this has to do with the item being recreated).
Any suggestions on how I can toggle the expander and select the row at the same time?