Databind selected items

Mar 7, 2010 at 7:36 PM



I'm using the datagrid in the toolbox and i want to do be able to select multiple rows in this datagrid. I have a solution using checkboxes "working", but you have to click twice, once to select a row and then one more click on the checkbox, this is terrible. What would be really cool, would be to just be able to select rows using control/shift in a windows-style to select rows and then databind the selected rows.


Anyone got a solution for either databinding selecting rows or a way to remove the extra click when using checkboxes?



Mar 8, 2010 at 7:53 AM



why don't you use the RowHeaders to select the rows (the area in front of each row, set the RowHeaderWidth property of the DataGrid if you don't see them).

With the right selection mode (SelectionMode = Extend, SelectionUnit either FullRow of CellOrRowHeader) the selection with Control/Shift already works fine.

If you like you could also place Checkboxes in the RowHeaders and bind their IsChecked property to the IsRowSelected property of the DataGridRowHeader

Hope this helps.