The Quick Access Toolbar (QAT) can be customized in just a few click(s). You can add or remove items from the QAT as well as move the position of QAT above or below the Ribbon.
You can add the frequently-used commands to QAT at runtime. To add a command to the QAT at run-time:
You can also remove items from the QAT. To remove any item from the Quick Access Toolbar at runtime:
You can display the QAT above or below the Ribbon, depending upon your requirements. To move the QAT below the Ribbon, click the drop-down arrow next to the QAT and select Show Below the Ribbon.
To move the QAT back to its location above the Ribbon, click the drop-down arrow next to the QAT and select Show Above the Ribbon.
To retain the QAT behavior across application runs, use QatItemNames property of Ribbon class. This property saves the items that users add or delete to the QAT during runtime, ensuring they are preserved for future sessions.
Below steps illustrate creating persistent QAT as shown in the following image:
C# |
Copy Code
|
---|---|
//Saving the items in QAT
Properties.Settings.Default.QatItems = customRibbon.QatItemNames;
Properties.Settings.Default.Save();
|
C# |
Copy Code
|
---|---|
//Load the items saved in QatItems back to the QAT on the ribbon var savedQatItemNames = Properties.Settings.Default.QatItems; if (!string.IsNullOrEmpty(savedQatItemNames)) { customRibbon.QatItemNames = savedQatItemNames; } |