Category / Section
How to handle state persistence in the WPF Ribbon control?
1 min read
The Ribbon State Persistence feature helps to load the state of the WPF Ribbon control that existed when the application was closed. You can customize State Persistence in Ribbon, QuickAccessToolBar and RibbonWindow elements by using AutoPersist property. The default value of AutoPersist is False.
XAML
<Syncfusion:Ribbon Name="ribbon" AutoPersist="True" VerticalAlignment="Top" > <Syncfusion:Ribbon.QuickAccessToolBar> <Syncfusion:QuickAccessToolBar Syncfusion:WindowChrome.IsHitTestVisibleInChrome="True"/> </Syncfusion:Ribbon.QuickAccessToolBar> <Syncfusion:RibbonTab Caption="Folder"> <Syncfusion:RibbonBar Header="Clean Up"> <Syncfusion:RibbonComboBox> <Syncfusion:RibbonComboBoxItem Content="Cleanup Folder"/> <Syncfusion:RibbonComboBoxItem Content="Cleanup Folder and Sub Folders"/> </Syncfusion:RibbonComboBox> <Syncfusion:RibbonButton SizeForm="Small" SmallIcon="/Resources/Delete-All.png" Label="Delete All"/> <Syncfusion:RibbonButton SizeForm="Small" SmallIcon="/Resources/Recover-Deleted Items.png" Label="Recover Deleted Items"/> </Syncfusion:RibbonBar> <Syncfusion:RibbonBar Name="ribbonBar" Header="Properties"> <Syncfusion:RibbonButton SizeForm="Small" SmallIcon="/Resources/Show-in-Favorites.png" Label="Show in Favourites"/> <Syncfusion:RibbonButton SizeForm="Small" SmallIcon="/Resources/Properties.png" Label="Folder Properties"/> <Syncfusion:RibbonButton SizeForm="Small" SmallIcon="/Resources/Archive.png" Label="Auto Archieve Settings"/> </Syncfusion:RibbonBar> </Syncfusion:RibbonTab> <Syncfusion:RibbonTab Caption="Send/Receive" /> </Syncfusion:Ribbon>
C#
ribbon.AutoPersist = true;
The following screenshot displays the ribbon persisting state when the application closes and apply it back when the application restarts