Skip to main content
A newer version of this page is available. .

RibbonGalleryItemThemePaletteSelectorBehavior

The RibbonGalleryItemThemePaletteSelectorBehavior populates the associated RibbonGalleryBarItem with the available palettes and allows you to choose the application theme’s palette.

Attach the RibbonGalleryItemThemePaletteSelectorBehavior to a RibbonGalleryBarItem in a RibbonControl to use it.

<Window ...
    xmlns:dxr="http://schemas.devexpress.com/winfx/2008/xaml/ribbon"
    xmlns:dxmvvm="http://schemas.devexpress.com/winfx/2008/xaml/mvvm">
    <StackPanel>
        <dxr:RibbonControl>
            <dxr:RibbonDefaultPageCategory>
                <dxr:RibbonPage Caption="Home">
                    <dxr:RibbonPageGroup Caption="File">
                        <dxr:RibbonGalleryBarItem>
                            <dxmvvm:Interaction.Behaviors>
                                <dxr:RibbonGalleryItemThemePaletteSelectorBehavior />
                            </dxmvvm:Interaction.Behaviors>
                        </dxr:RibbonGalleryBarItem>
                    </dxr:RibbonPageGroup>
                </dxr:RibbonPage>
            </dxr:RibbonDefaultPageCategory>
        </dxr:RibbonControl>
    </StackPanel>
</Window>

RibbonGalleryThemeSelectorBehavior

View Example

Persist Theme Selection between Application Runs

You can save the application’s theme and palette to the configuration file and restore them on the next application run.

To save an applied theme and palette, use the static ApplicationThemeHelper.SaveApplicationThemeName method to save the theme name specified in the static ApplicationThemeHelper.ApplicationThemeName property:

private void Application_Exit(object sender, StartupEventArgs e) {
    ApplicationThemeHelper.SaveApplicationThemeName();
}        

Call the static ApplicationThemeHelper.UpdateApplicationThemeName method to retrieve the theme name from the configuration file and apply it to your application:

private void Application_Startup(object sender, ExitEventArgs e) {
    ApplicationThemeHelper.UpdateApplicationThemeName();
}