ClientTheme
Wisej.Core.ClientTheme
Last updated
Was this helpful?
Wisej.Core.ClientTheme
Last updated
Was this helpful?
Namespace: Wisej.Core
Assembly: Wisej.Framework (4.0.0.0)
Represents a Wisej theme.
You can create a new custom theme based on an existing theme, empty, or initialized from a JSON string.
You can alter any aspect of a theme by using the dynamic properties: Colors, Images, Fonts, Appearances, Settings, and Stylesheet. These properties, being dynamic, can support any field and any structure. To alter these properties in a way that doesn't break the theme, look at the theme's structure in the ThemeBuilder or a text editor. To save a custom theme you may convert it to a JSON string simply by calling the ToJSON extension method added to all objects by the Wisej framework.
Default private constructor.
name
Unique name of the theme.
Constructs a new theme from the name and JSON definition.
name
Unique name of the theme.
json
JSON definition of the theme.
Constructs a new theme from the base theme.
name
Unique name of the theme.
baseTheme
Original theme to copy into the new theme.
Object: Theme appearances.
This is a complex dynamic object with several child objects. The structure can get quite complicated. Before messing with the Appearances object, please study the structure of the themes using the ThemeBuilder or a text editor. Being a dynamic object, you can either create a new appearance or alter an existing appearance at any level.
Object: Theme colors.
You can add or change any color in the current theme:
String: The file path where the theme was loaded from. If it was loaded from embedded resources this is null.
Object: Theme fonts.
You can add or alter any font to the theme. The structure of the font definition can get complicated. Please refer to the existing themes and the ThemeBuilder to determine the structure to use. The simplest way is to change an existing theme font:
Object: Theme images.
You can add or change any theme image. Images in the theme are just URLs but can be defined in several ways:
Absolute URL An URL starting with http: or https: pointing to an image resource.
Relative URL An URL relative to the current site or relative to value of Images.baseUrl.
base64 A base64 encoded embedded image.
Boolean: Returns if the theme is a mixin.
String: The name of the theme.
String: Design time project root path.
Object: Theme settings.
The Settings property allows a theme to define certain internal properties. Currently these are the supported properties:
native-scrollbars Instructs Wisej.NET to use the native scrollbars instead of the themed scrollbars. Setting this property can have negative side effects for virtual scrolling widgets like the DataGridView. The default is false.
overlapped-scrollbars Instructs Wisej to layout the scrollbars over the content being scrolled, similar to Windows' fluent themes or mobiles. The default is false.
Object: Stylesheet rules embedded in the theme.
The Stylesheet property is a new theme property added since Wisej 2.0. It allows a theme to define a set of CSS rules, just as if Default.html specified a css file. This property has only one string array field: "rules". When the theme is rendered, the client library joins all the rules into a css string and creates a stylesheet loaded into the browser.
String: Design time or runtime theme path.
Merges the mixin theme extensions with the theme.
designMode
If designMode = true, the theme is regenerated from the original JSON string. At design time it is possible to change the extensions applied to an already loaded theme.
Optional list of theme mixins. If null, the default theme mixins are always applied.
Returns: ClientTheme.
Merges the mixin theme extensions with the theme.
mixins
List of mixins to apply to the theme.
designMode
If designMode = true, the theme is regenerated from the original JSON string. At design time it is possible to change the extensions applied to an already loaded theme.
Returns: ClientTheme.
Returns the resolved color defined in the theme for the specified appearance, property or style name and optionally the state.
appearance
The appearance path that identifies the component in the theme. Nested appearances can be specified using a forward slash: i.e. window/captionbar.
name
The name of the property or the style value to query.
The name of the state to query. It's optional. The default is "default".
Returns: Color. A Color representing the color in the theme.
Returns the resolved theme color from the color list.
name
The name of the color to resolve from the color list.
Returns: Color. A Color representing the color in the theme.
Returns the resolved font defined in the theme for the specified appearance, property name and optionally the state.
appearance
The appearance path that identifies the component in the theme. Nested appearances can be specified using a forward slash: i.e. window/captionbar.
name
The name of the property value to query.
The name of the state to query. It's optional. The default is "default".
Returns: Font. A Font representing the queried font or null if not found.
Returns the resolved font defined from the font list.
name
Returns: Font. A Font representing the queried font or null if not found.
Returns the resolved image defined in the theme for the specified appearance, property or style name and optionally the state.
appearance
The appearance path that identifies the component in the theme. Nested appearances can be specified using a forward slash: i.e. window/captionbar.
name
The name of the property or the style value to query.
The name of the state to query. It's optional. The default is "default".
Returns: Image. A Image representing the queried image or null if not found. SVG images at runtime always return null, they are resolved only at design time.
Returns the resolved image defined from the image list.
name
Returns: Image. A Image representing the queried image or null if not found. SVG images at runtime always return null, they are resolved only at design time.
Returns the size of the inset border and padding.
appearance
The name of the appearance in the theme. Child component appearances can be specified using the forward slash, i.e. "button/icon".
The state that defines the property. It can omitted, the default state is "default".
Whether to include padding in the insets dimension.
Returns: Padding. Dimension of the border and optionally the padding as a Padding value
Retrieves the ClientTheme from the cache or loads it from a file in the application /Themes directory or from the embedded resources in any loaded assembly marked with the assembly:WisejResourcesAttribute.
name
Name of the theme file or resource, without the path and the extension.
reload
True to force a full reload of the theme.
Returns: ClientTheme. A ClientTheme instance.
Retrieves the ClientTheme from the cache or loads it from a file in the application /Themes directory or from the embedded resources in any loaded assembly marked with the assembly:WisejResourcesAttribute.
name
Name of the theme file or resource, without the path and the extension.
Returns: ClientTheme. A ClientTheme instance.
Returns the property value for the specified name and state within the specified appearance key.
T
appearance
The name of the appearance in the theme. Child component appearances can be specified using the forward slash, i.e. "button/icon".
name
The name of the property to retrieve.
The state that defines the property. It can omitted, the default state is "default".
Returns: T. The typed value of the requested property, or default(T) if not found.
Returns the style value for the specified name and state within the specified appearance key.
T
appearance
The name of the appearance in the theme. Child component appearances can be specified using the forward slash, i.e. "button/icon".
name
The name of the property to retrieve.
The state that defines the property. It can omitted, the default state is "default".
Returns: T. The typed value of the requested style, or default(T) if not found.
Returns true if the color is a theme color.
color
Color to check.
Returns: Boolean. True if color is a theme color.
Since the theme may also define SystemColors, using IsThemeColor on a system color returns false, but the rendering on the browser will use the color in the theme, if defined.
Returns true if the font is a theme font.
font
Font to check.
Returns: Boolean. True if font is a theme font.
Theme fonts (font's with the OriginalFontName starting with "@") are always rendered using the definition in the theme for their size and style. However, an application may use a theme font and change the size and style. In this case, the OriginalFontName is the theme name without the "@". If the name of the font (which could be a system name like "Arial") matches a theme font, Wisej will use the theme font but it uses the size and style set by the application.
Returns the resolved Color with the proper RGB values. If the color specified in color is a theme color, the value is resolved from the current theme, otherwise the original color is returned.
color
Returns: Color. A Color instance with the resolved RGB values.
Returns the resolved Font from the theme font. If the font is a theme font, the value is resolved from current theme.
font
Returns: Font. A Font instance that can be used directly.
Allows an object to serialize itself.
mixins
state
state
state
state
includePadding
The of the value to retrieve.
state
The of the value to retrieve.
state
The to resolve to a usable value.
The to resolve to a usable instance.