is there a way to mimic the behavior of ctrl+click which keeps previously selected rows selected and just adds more selected items?
by default, when clicking on each row, all previously selected rows get de-selected.
one way to achieve this, would be to override SelectionChanged event, and re-select removed rows.
void TestGrid_SelectionChanged(object sender, SelectionChangedEventArgs e) {
foreach (var i in e.RemovedItems)
TestGrid.SelectedItems.Add(i);
}
This is not ideal however, because in some situations i would want to de-select rows (such as when clicking a toggle button in one of the columns).
here’s a solution that worked for me.
i removed all properties that set details visiblity (to keep everything at default)
than added the following style
assigned this resource to RowStyle
in my underlying data object, i added Visible property, and Implemented INotifyPropertyChanged interface.
now whenever i want to show/hide details, i simply manipulate the Visible property on my underlying object. this can happen from column button handler, to anywhere else in my code. works great