I'm keeping track of the items that are selected and unselected in the gridview by adding/removing from a list in the SelectionChanged event handler. Unfortunately, when I change the groups it fires a selection changed for each of the items as if they are being unselected. The basic structure of the function I'm using is as follows:
So if an unselect fires for each of the items, then my list will be empty when the groups are changed. The whole purpose of the list was so that I could restore the selections when the grouping was completed.
Is there a way that I could prevent the items from being removed from the list when the groups are changed? A property or something that I could check against in the removal foreach statement?
Thanks in advance
static void gv_SelectionChanged(object sender, SelectionChangeEventArgs e) |
{ |
if (changingSelection) |
return; |
changingSelection = true; |
var gv = e.Source as RadGridView; |
if (gv != null) |
{ |
foreach (CatalogItem addedItem in e.AddedItems) |
{ |
//code for adding selection to list |
} |
foreach (CatalogItem removedItem in e.RemovedItems) |
{ |
//code for removing selection from list |
} |
} |
changingSelection = false; |
} |
So if an unselect fires for each of the items, then my list will be empty when the groups are changed. The whole purpose of the list was so that I could restore the selections when the grouping was completed.
Is there a way that I could prevent the items from being removed from the list when the groups are changed? A property or something that I could check against in the removal foreach statement?
Thanks in advance