Skip to main content
All docs
V25.1
  • DevExpress v25.1 Update — Your Feedback Matters

    Our What's New in v25.1 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

    Take the survey Not interested

    IThemeChangeService Interface

    In This Article

    Allows you to switch between themes at runtime.

    Namespace: DevExpress.Blazor

    Assembly: DevExpress.Blazor.v25.1.dll

    NuGet Package: DevExpress.Blazor

    #Declaration

    C#
    public interface IThemeChangeService

    #Remarks

    The theme change service allows you to switch between multiple themes at runtime. To change an application theme, inject IThemeChangeService with the [Inject] attribute into a Razor page and call the SetTheme(ITheme) method:

    Razor
    @inject IThemeChangeService ThemeChangeService
    @rendermode InteractiveServer
    
    <DxButton Text="Blazing Berry" Click="() => HandleClick(Themes.BlazingBerry)" />
    <DxButton Text="Fluent" Click="() => HandleClick(Themes.Fluent)" />
    <DxButton Text="Fluent Dark" Click="() => HandleClick(AppThemes.FluentDark)" />
    
    @code {
        void HandleClick(ITheme theme) {
            ThemeChangeService.SetTheme(theme);
            // ...
        }
        public class AppThemes {
            public static ITheme FluentDark = Themes.Fluent.Clone(properties => {
                properties.Name = "FluentDark";
                properties.Mode = ThemeMode.Dark;
            });
            public static List<ITheme> All { get; private set; } = new List<ITheme>() {
                Themes.BlazingBerry,
                Themes.Fluent,
                FluentDark
            };
        }
    }
    
    See Also