public void Dispose() { if (selected.Count > 0) { var finalSelected = new List <int>(); var dataStore = grid.DataStore; if (dataStore != null) { // go through list to find indexes of previously selected items int row = 0; foreach (var item in dataStore) { if (selected.Contains(item)) { finalSelected.Add(row); } row++; } } grid.SelectedRows = finalSelected; if (finalSelected.Count != selectedCount) { grid.OnSelectionChanged(EventArgs.Empty); } } grid.supressSelectionChanged = false; }
private void ChangeSelection(Action a) { state = GridViewSelectionState.SelectionChanging; a(); // Causes GridView.OnSelectionChanged to trigger which calls SuppressSelectionChanged which returns true. state = GridViewSelectionState.SelectionChanged; gridView.OnSelectionChanged(EventArgs.Empty); // Calls SuppressSelectionChanged which returns false. state = GridViewSelectionState.Normal; // This should already be done in SuppressSelectionChanged but repeated for robustness }