Skip to main content
All docs
V25.1
  • RibbonGalleryItemThemePaletteSelectorBehavior Class

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

    Namespace: DevExpress.Xpf.Ribbon

    Assembly: DevExpress.Xpf.Ribbon.v25.1.dll

    NuGet Package: DevExpress.Wpf.Ribbon

    Declaration

    [TargetType(typeof(RibbonGalleryBarItem))]
    public class RibbonGalleryItemThemePaletteSelectorBehavior :
        RibbonGalleryItemThemeSelectorBehavior

    Remarks

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

    <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>
    

    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();
    }
    

    The following code snippet (auto-collected from DevExpress Examples) contains a reference to the RibbonGalleryItemThemePaletteSelectorBehavior class.

    Note

    The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

    Inheritance

    Show 13 items
    Object
    DispatcherObject
    DependencyObject
    Freezable
    Animatable
    DevExpress.Mvvm.UI.Interactivity.AttachableObjectBase
    DevExpress.Mvvm.UI.Interactivity.Behavior
    DevExpress.Mvvm.UI.Interactivity.Behavior<RibbonGalleryBarItem>
    DevExpress.Xpf.Bars.ThemeSelectorBehavior<RibbonGalleryBarItem>
    DevExpress.Xpf.Bars.BarItemThemeSelectorBehavior<RibbonGalleryBarItem>
    DevExpress.Xpf.Bars.GalleryBarItemThemeSelectorBehavior<RibbonGalleryBarItem>
    RibbonGalleryItemThemeSelectorBehavior
    RibbonGalleryItemThemePaletteSelectorBehavior
    See Also