All docs
V20.2
21.2
21.1
20.2
20.1
19.2
The page you are viewing does not exist in version 19.2. This link will take you to the root page.
19.1
The page you are viewing does not exist in version 19.1. This link will take you to the root page.
18.2
The page you are viewing does not exist in version 18.2. This link will take you to the root page.
18.1
The page you are viewing does not exist in version 18.1. This link will take you to the root page.
17.2
The page you are viewing does not exist in version 17.2. This link will take you to the root page.
A newer version of this page is available. Switch to the current version.

HamburgerSubMenuThemeSelectorBehavior Class

Populates the associated HamburgerSubMenu with available themes and allows you to choose the application’s theme.

Namespace: DevExpress.Xpf.WindowsUI

Assembly: DevExpress.Xpf.Controls.v20.2.dll

Declaration

[TargetType(typeof(HamburgerSubMenu))]
public class HamburgerSubMenuThemeSelectorBehavior :
    ThemeSelectorBehavior<HamburgerSubMenu>

Remarks

To use the HamburgerSubMenuThemeSelectorBehavior, attach it to a HamburgerSubMenu:

<Window ...
    xmlns:dxwui="http://schemas.devexpress.com/winfx/2008/xaml/windowsui"
    xmlns:dxmvvm="http://schemas.devexpress.com/winfx/2008/xaml/mvvm">
    <Grid>
        <dxwui:HamburgerMenu>
            <dxwui:HamburgerSubMenu>
                <dxmvvm:Interaction.Behaviors>
                    <dxwui:HamburgerSubMenuThemeSelectorBehavior/>
                </dxmvvm:Interaction.Behaviors>
            </dxwui:HamburgerSubMenu>
        </dxwui:HamburgerMenu>
    </Grid>
</Window>

DevExpress HamburgerSubMenu | HamburgerSubMenuThemeSelectorBehavior

View Example: How to Implement a Theme Selector Based on a Hamburger SubMenu

Display Themes in the HamburgerSubMenu Preview

You can pass a theme name to the PreviewThemeNames property to display themes in the HamburgerSubMenu preview. If you specify multiple themes, separate them with a comma.

The following code sample displays the VS2017Light VS2017Dark, Office2019White, and Office2019HighContrast themes in the HamburgerSubMenu preview:

<Window ...
    xmlns:dxwui="http://schemas.devexpress.com/winfx/2008/xaml/windowsui"
    xmlns:dxmvvm="http://schemas.devexpress.com/winfx/2008/xaml/mvvm">
    <Grid>
        <dxwui:HamburgerMenu>
            <dxwui:HamburgerSubMenu>
                <dxmvvm:Interaction.Behaviors>
                    <dxwui:HamburgerSubMenuThemeSelectorBehavior PreviewThemeNames="VS2017Light,VS2017Dark,Office2019White,Office2019HighContrast"/>
                </dxmvvm:Interaction.Behaviors>
            </dxwui:HamburgerSubMenu>
        </dxwui:HamburgerMenu>
    </Grid>
</Window>

DevExpress HamburgerSubMenu | HamburgerSubMenuThemeSelectorBehavior PreviewThemeNames

Persist Theme Selection between Application Runs

You can save the application’s theme to the configuration file and restore it in the next application run.

To save an applied theme, 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.

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

Hide Themes from Theme Selector

You can use the Theme.ShowInThemeSelector property to hide a theme/theme category from the HamburgerSubMenuThemeSelectorBehavior‘s theme gallery.

The following code sample hides Office2007 and Metropolis theme categories, and the DeepBlue application theme:

<Window ...
    xmlns:dxwui="http://schemas.devexpress.com/winfx/2008/xaml/windowsui"
    xmlns:dxmvvm="http://schemas.devexpress.com/winfx/2008/xaml/mvvm">
    <Grid>
        <dxwui:HamburgerMenu>
            <dxwui:HamburgerSubMenu>
                <dxmvvm:Interaction.Behaviors>
                    <dxwui:HamburgerSubMenuThemeSelectorBehavior/>
                </dxmvvm:Interaction.Behaviors>
            </dxwui:HamburgerSubMenu>
        </dxwui:HamburgerMenu>
    </Grid>
</Window>
using DevExpress.Xpf.Core;

public partial class App : Application {
    public App() {
        foreach (Theme theme in Theme.Themes.ToList()) {
            if (theme.Category == Theme.Office2007Category ||
                theme.Category == Theme.MetropolisCategory || 
                theme.Name == "DeepBlue") theme.ShowInThemeSelector = false;
        }
    }
}

Hide Touch Themes

Set the behavior’s inherited ShowTouchThemes property to false to hide touch themes from the HamburgerSubMenuThemeSelectorBehavior‘s theme gallery:

<Window ...
    xmlns:dxwui="http://schemas.devexpress.com/winfx/2008/xaml/windowsui"
    xmlns:dxmvvm="http://schemas.devexpress.com/winfx/2008/xaml/mvvm">
    <Grid>
        <dxwui:HamburgerMenu>
            <dxwui:HamburgerSubMenu>
                <dxmvvm:Interaction.Behaviors>
                    <dxwui:HamburgerSubMenuThemeSelectorBehavior ShowTouchThemes="False"/>
                </dxmvvm:Interaction.Behaviors>
            </dxwui:HamburgerSubMenu>
        </dxwui:HamburgerMenu>
    </Grid>
</Window>

Inheritance

Object
DispatcherObject
DependencyObject
Freezable
Animatable
DevExpress.Mvvm.UI.Interactivity.AttachableObjectBase
DevExpress.Mvvm.UI.Interactivity.Behavior
DevExpress.Mvvm.UI.Interactivity.Behavior<HamburgerSubMenu>
DevExpress.Xpf.Bars.ThemeSelectorBehavior<HamburgerSubMenu>
HamburgerSubMenuThemeSelectorBehavior
See Also