/// <summary> /// Occurs when the selection changes. /// </summary> /// <param name="sender">The sender of the event.</param> /// <param name="e">A <see cref="SelectionChangedEventArgs"/> that contains the event data.</param> private void OnAvailableQatCategoriesListBoxSelectionChanged(object sender, SelectionChangedEventArgs e) { RibbonControlCustomizationCategory category = availableQatCategoriesComboBox.SelectedItem as RibbonControlCustomizationCategory; if (category != null) { DeferrableObservableCollection <RibbonControlReference> items = category.GetControls(); availableQatItemsListBox.ItemsSource = items; } else { availableQatItemsListBox.ItemsSource = null; } }
///////////////////////////////////////////////////////////////////////////////////////////////////// // NON-PUBLIC PROCEDURES ///////////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> /// Initializes the window. /// </summary> private void Initialize() { // Get the list of customization categories DeferrableObservableCollection <RibbonControlCustomizationCategory> categories = RibbonControlCustomizationCategory.GetCategories(this.Ribbon); availableQatCategoriesComboBox.ItemsSource = categories; if (categories.Count > 1) { availableQatCategoriesComboBox.SelectedIndex = 1; } // Get the list of items already on the QAT qatItems = RibbonControlCustomizationCategory.GetQuickAccessToolBarItems(this.Ribbon); qatItemsListBox.ItemsSource = qatItems; }
/// <summary> /// Saves any changes that have been made. /// </summary> public void Save() { // Update the QAT items per the updated list on this window RibbonControlCustomizationCategory.SetQuickAccessToolBarItems(this.Ribbon, qatItems); }
///////////////////////////////////////////////////////////////////////////////////////////////////// // PUBLIC PROCEDURES ///////////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> /// Cancels any changes that have been made. /// </summary> public void Cancel() { // Dispose cloned items that are in the list of QAT items on this Window but will not be added to the real QAT RibbonControlCustomizationCategory.DisposeUnusedClones(this.Ribbon, qatItems); }