ThemeService Class

Service for theme registration and management.

Inheritance

Object

ThemeService

Namespace: Radzen

Assembly: Radzen.Blazor.dll

Syntax

public class ThemeService

Constructors

ThemeServiceLink to this section

Service for theme registration and management.

Declaration
public ThemeService(Microsoft.JSInterop.IJSRuntime jsRuntime, IServiceProvider serviceProvider)
Parameters
Type Name Description
Microsoft.JSInterop.IJSRuntime jsRuntime
IServiceProvider serviceProvider

Properties

CssPathLink to this section

Custom css path. If set, it overwrites the default path.

Declaration
public string CssPath { get; }
Property Value
Type Description
stringCustom css path. If set, it overwrites the default path.

RightToLeftLink to this section

Specify if the theme should be right-to-left.

Declaration
public bool? RightToLeft { get; }
Property Value
Type Description
bool?Specify if the theme should be right-to-left.

ThemeLink to this section

Gets the current theme.

Declaration
public string Theme { get; }
Property Value
Type Description
stringGets the current theme.

WcagLink to this section

Specify if the theme colors should meet WCAG contrast requirements.

Declaration
public bool? Wcag { get; }
Property Value
Type Description
bool?Specify if the theme colors should meet WCAG contrast requirements.

Methods

SetCssPathLink to this section

Sets a specific css path to the theme service.

Declaration
public void SetCssPath(string cssPath)
Parameters
Type Name Description
string cssPath New css path to look for themes.

SetRightToLeftLink to this section

Specifies if the theme should be right-to-left.

Declaration
public void SetRightToLeft(bool rightToLeft)
Parameters
Type Name Description
bool rightToLeft

SetThemeLink to this section

Changes the current theme.

Declaration
public void SetTheme(string theme, bool triggerChange)
Parameters
Type Name Description
string theme
bool triggerChange

SetThemeLink to this section

Changes the current theme.

Declaration
public void SetTheme(ThemeOptions options)
Parameters
Type Name Description
ThemeOptions options

SetWcagLink to this section

Enables or disables WCAG contrast requirements.

Declaration
public void SetWcag(bool wcag)
Parameters
Type Name Description
bool wcag

Events

ThemeChangedLink to this section

Raised when the theme changes.

Declaration
public event Action ThemeChanged
An error has occurred. This app may no longer respond until reloaded. Reload 🗙