/// <summary> /// Update all grouping options. This method is intended to be called only from parent view. /// </summary> /// <param name="stateManager">The new state manager for the hosted page.</param> public void ReloadGroupingOptions(IPageGroupingStateManager stateManager) { IsNavigationOpsAvailable = false; _stateManager = stateManager; SortingOptions.Clear(); // Reload options var options = _stateManager.PopulateAvailablePairs(); foreach (var option in options) { SortingOptions.Add(option); } // Set default option // We don't need to set it - it is already passed to view var lastUsedOption = _stateManager.GetLastUsedPair(); var elem = SortingOptions.Where(i => i.Identifier == lastUsedOption.Identifier).ToList(); if (elem.Any()) { SelectedItemIndex = SortingOptions.IndexOf(elem.FirstOrDefault()); } // Enable selection IsNavigationOpsAvailable = true; }