RibbonGalleryItemThemePaletteSelectorBehavior
The RibbonGalleryItemThemePaletteSelectorBehavior automatically populates the associated RibbonGalleryBarItem with all the available palettes. This allows you to select a palette and apply it to your application.
Attach the RibbonGalleryItemThemePaletteSelectorBehavior to a RibbonGalleryBarItem in a RibbonControl to use it.
<dxr:RibbonGalleryBarItem ... >
<dxmvvm:Interaction.Behaviors>
<dxr:RibbonGalleryItemThemePaletteSelectorBehavior />
</dxmvvm:Interaction.Behaviors>
</dxr:RibbonGalleryBarItem>
Tip
Use the static ApplicationThemeHelper.SaveApplicationThemeName method to save the theme name specified in the static ApplicationThemeHelper.ApplicationThemeName property to the application’s configuration file.
The following example adds the theme palette list Ribbon Gallery to your application:
Note
A complete sample project is available at https://github.com/DevExpress-Examples/how-to-implement-a-theme-palette-selector-based-on-a-bar-item.
<dx:ThemedWindow
x:Class="ThemeHelperWPF.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
xmlns:dxr="http://schemas.devexpress.com/winfx/2008/xaml/ribbon"
xmlns:dxmvvm="http://schemas.devexpress.com/winfx/2008/xaml/mvvm"
Title="MainWindow" Height="350" Width="525"
WindowKind="Ribbon">
<Grid>
<dxr:RibbonControl x:Name="RibbonControl" DockPanel.Dock="Top">
<dxr:RibbonDefaultPageCategory>
<dxr:RibbonPage Caption="Home"/>
<dxr:RibbonPage Caption="Settings" IsSelected="True">
<dxr:RibbonPageGroup Caption="Themes">
<dxr:RibbonGalleryBarItem>
<dxmvvm:Interaction.Behaviors>
<dxr:RibbonGalleryItemThemeSelectorBehavior ShowTouchThemes="False"/>
</dxmvvm:Interaction.Behaviors>
</dxr:RibbonGalleryBarItem>
<dxr:RibbonGalleryBarItem>
<dxmvvm:Interaction.Behaviors>
<dxr:RibbonGalleryItemThemePaletteSelectorBehavior />
</dxmvvm:Interaction.Behaviors>
</dxr:RibbonGalleryBarItem>
</dxr:RibbonPageGroup>
</dxr:RibbonPage>
</dxr:RibbonDefaultPageCategory>
</dxr:RibbonControl>
</Grid>
</dx:ThemedWindow>