Ribbon Control Quick Access Toolbar Customization
Our Ribbon control out of box includes a complete Quick Access Toolbar (referred to further as QAT) customization with built-in extensibility so customization dialogs can be used and existing customization panels reused in the dialogs.
QAT Customization Key Properties
- RibbonControl.CanCustomize – Set by default to true indicates whether QAT can be customized.
- BaseItem.CanCustomize – Each item added to RibbonBar has CanCustomize property. When set to false it indicates that item cannot be added to Quick Access Toolbar and it will not appear on Quick Access Toolbar customization dialog.
- RibbonControl.EnableQatPlacement – Controls whether positioning of the QAT can be changed. QAT can be placed above (default) or below the Ribbon control.
- RibbonContro.UseCustomizeDialog - Controls whether the “Customize Quick Access Toolbar” menu item is visible which invokes the customize dialog.
- RibbonControl.ShowQatCustomizeDialog method shows the customize dialog
- RibbonControl.CategorizeMode – Indicates the categorization mode for the items on the customize dialog. Categories are displayed in the combo box on the customize dialog. Default value is RibbonBar which indicates that items are categorized by the RibbonBar they appear on. This setting is completely automatic and it does not require any additional work except simply creating the Ribbon Bars and adding items to them. The second categorization mode is Categories. For this mode to work correctly you must set the Category property for each item created.
The CanCustomize property on each item determines whether item is available for customization or not.
- RibbonControl.QatPositionedBelowRibbon property gets or sets whether the QAT is positioned below or above the Ribbon control. You can use it to change the position of the QAT.
- RibbonControl.QatLayout property holds the layout of the QAT and you can use it to save and restore the QAT layout which includes the actual items on the QAT and their position. See RibbonPad sample for an example.
- RibbonControl.SystemText property returns the localization object that allows you to change the system text used by the Ribbon control only. To localize system texts that can be shared by multiple components you can handle the RibbonControl.LocalizeString event. LocalizationKeys class has static members that describe the keys you can use to identify the requested system text.
- RibbonControl.QatLayoutChanged gets or sets whether the end-user has customized the QAT.
- RibbonControl.QuickToolbarItems collection holds all items that are visible on Quick Access Toolbar.
Customizing the QAT system context menu
The QAT system menu is displayed when an item on the Ribbon Bar or QAT is right-clicked. You can remove or add your own items to this context menu by handling RibbonControl.BeforeCustomizeMenuPopup. RibbonCustomizeEventArgs which are passed into this event can be used to Cancel the display of the context menu, check the ContextObject which is the object that the context menu is being displayed for and obtain the reference to the PopupMenu which is the actual context menu parent. PopupMenu.SubItems collection will contain all of the customization items and you can remove them, change them, or add your own. Static read-only members SysQatCustomizeItemName, SysQatAddToItemName, SysQatRemoveFromItemName, SysQatPlaceItemName of RibbonControl provide the names of the system items.
Replacing or Customizing QAT Customization Dialog
To replace or customize a QAT Customize Dialog you must handle the BeforeQatCustomizeDialog event. QatCustomizeDialogEventArgs object passed into the event handler allows you to Cancel the display of the dialog and gives you access to the actual Dialog form that will be displayed. You can set the Dialog property so your custom dialog is displayed instead of the system dialog.
You can also use the QatCustomizePanel control on your own QAT customization dialog to reuse existing customization functionality.
- Using QatCustomizePanel on custom Quick Access Toolbar customization dialogs
- How To Enable Control Hosting On Quick Access Toolbar Items
- How to loop through all ribbon tabs, ribbon bar and items on WinForms Ribbon control
- How to create Ribbon Tab Groups in DotNetBar for WinForms
- Tips when working with Ribbon control from code