Class
ThemeResolutionService

Provides centralized theme management and resolution services for RadControls applications.

Definition

Namespace:Telerik.WinControls

Assembly:Telerik.WinControls.dll

Syntax:

cs-api-definition
public class ThemeResolutionService

Inheritance: objectThemeResolutionService

Constructors

ThemeResolutionService()

Declaration

cs-api-definition
public ThemeResolutionService()

Fields

TelerikFluentIconsFontName

Declaration

cs-api-definition
public static string TelerikFluentIconsFontName

Field Value

string

TelerikWebUIFontName

Declaration

cs-api-definition
public static string TelerikWebUIFontName

Field Value

string

WebComponentsIconsFontName

Declaration

cs-api-definition
public static string WebComponentsIconsFontName

Field Value

string

Properties

AllowAnimations

Determines whether animations are allowed across entire application.

Declaration

cs-api-definition
public static bool AllowAnimations { get; set; }

Property Value

bool

ApplicationThemeName

Gets or sets value indicating the theme name that will be used by all controls in the application.

Declaration

cs-api-definition
public static string ApplicationThemeName { get; set; }

Property Value

string

Remarks

If the value of this property is null or empty each control will be assigned a theme, corresponding on the ThemeName property of the control. Otherwise the ThemeName property will be disregarded. If a specific control in the application has no theme registered with the name specified by ApplicationThemeName, it will be assigned its ControlDefault theme name.

ControlDefaultThemeName

"ControlDefault" theme name

Declaration

cs-api-definition
public static string ControlDefaultThemeName { get; set; }

Property Value

string

SystemThemeName

Declaration

cs-api-definition
public static string SystemThemeName { get; }

Property Value

string

Methods

ApplyThemeToControlTree(Control, string)

Applies the specified ThemeName to all RadControls that are children of the specified Control and its child Controls

Declaration

cs-api-definition
public static void ApplyThemeToControlTree(Control control, string themeName)

Parameters

control

Control

themeName

string

ClearTheme(string)

Clears all stylesheets registered previously with the themeName specified.

Declaration

cs-api-definition
public static void ClearTheme(string themeName)

Parameters

themeName

string

EnsureThemeRegistered(string)

Creates and registers an empty Theme if one is not already registered.

Declaration

cs-api-definition
public static Theme EnsureThemeRegistered(string themeName)

Parameters

themeName

string

Returns

Theme

GetAvailableThemes()

Gets a list of all registered themes.

Declaration

cs-api-definition
public static ICollection GetAvailableThemes()

Returns

ICollection

GetAvailableThemes(IComponentTreeHandler)

Gets any themes registered for a specific control by control type name or control name.

Declaration

cs-api-definition
public static List<Theme> GetAvailableThemes(IComponentTreeHandler control)

Parameters

control

IComponentTreeHandler

Returns

List<Theme>

GetCustomFont(string)

Returns a previously loaded font by given font name.

Declaration

cs-api-definition
public static FontFamily GetCustomFont(string fontName)

Parameters

fontName

string

The name of font.

Returns

FontFamily

The FontFamily or null if font with given name is not loaded.

GetCustomFonts()

Declaration

cs-api-definition
public static FontFamily[] GetCustomFonts()

Returns

FontFamily[]

GetFont(string, float, FontStyle)

Returns a font by given font name. The font can be custom(loaded in memory) or installed on the machine.

Declaration

cs-api-definition
public static Font GetFont(string fontName, float fontSize, FontStyle fontStyle)

Parameters

fontName

string

The name of the font or custom font.

fontSize

float

The size of the font.

fontStyle

FontStyle

Returns

Font

The Font or the default font if font with given name is not valid.

GetStyleSheetBuilder(IComponentTreeHandler, string, string, string)

Declaration

cs-api-definition
public static StyleGroup GetStyleSheetBuilder(IComponentTreeHandler control, string elementTypeFullName, string elementName, string proposedThemeName)

Parameters

control

IComponentTreeHandler

elementTypeFullName

string

elementName

string

proposedThemeName

string

Returns

StyleGroup

GetStyleSheetBuilder(RadElement)

Declaration

cs-api-definition
public static StyleGroup GetStyleSheetBuilder(RadElement element)

Parameters

element

RadElement

Returns

StyleGroup

GetStyleSheetBuilder(RadElement, string)

Declaration

cs-api-definition
public static StyleGroup GetStyleSheetBuilder(RadElement element, string proposedThemeName)

Parameters

element

RadElement

proposedThemeName

string

Returns

StyleGroup

GetStyleSheetBuilders(string)

Gets all StyleSheets registered under a theme name.

Declaration

cs-api-definition
public static StyleGroup[] GetStyleSheetBuilders(string themeName)

Parameters

themeName

string

Returns

StyleGroup[]

GetTheme(string)

Get previously registered theme by theme name.

Declaration

cs-api-definition
public static Theme GetTheme(string themeName)

Parameters

themeName

string

Returns

Theme

GetThemeRepository(string, bool, bool)

Declaration

cs-api-definition
public static XmlStyleRepository GetThemeRepository(string themeName, bool useAsterikTheme, bool useAppThemeName)

Parameters

themeName

string

useAsterikTheme

bool

useAppThemeName

bool

Returns

XmlStyleRepository

LoadFont(Stream)

Declaration

cs-api-definition
public static int LoadFont(Stream fontStream)

Parameters

fontStream

Stream

Returns

int

LoadFont(string)

Declaration

cs-api-definition
public static int LoadFont(string resourcePath)

Parameters

resourcePath

string

Returns

int

LoadPackageFile(string)

Loads a theme package, stored in the provided file.

Declaration

cs-api-definition
public static bool LoadPackageFile(string filePath)

Parameters

filePath

string

Returns

bool

LoadPackageFile(string, bool)

Loads a theme package stored in the provided file.

Declaration

cs-api-definition
public static bool LoadPackageFile(string filePath, bool throwOnError)

Parameters

filePath

string

throwOnError

bool

True to throw an exception if it occurs, false otherwise.

Returns

bool

LoadPackageResource(Assembly, string)

Loads a theme package from an embedded resource in the specified assembly.

Declaration

cs-api-definition
public static bool LoadPackageResource(Assembly sourceAssembly, string resourcePath)

Parameters

sourceAssembly

Assembly

resourcePath

string

Returns

bool

LoadPackageResource(ResourceParams, bool)

Loads a theme package stored in the provided embedded resource.

Declaration

cs-api-definition
public static bool LoadPackageResource(ThemeResolutionService.ResourceParams resourceParams, bool throwOnError)

Parameters

resourceParams

ThemeResolutionService.ResourceParams

throwOnError

bool

True to throw an exception if it occurs, false otherwise.

Returns

bool

LoadPackageResource(string)

Loads a theme package, stored in the provided embedded resource. The calling assembly is used to read the manifest resource stream.

Declaration

cs-api-definition
public static bool LoadPackageResource(string resourcePath)

Parameters

resourcePath

string

Returns

bool

RaiseThemeChanged(string, string)

Declaration

cs-api-definition
public static void RaiseThemeChanged(string themeName, string controlThemeClassName)

Parameters

themeName

string

controlThemeClassName

string

RegisterControlStyleBuilder(string, string, StyleGroup, string)

Registers a StyleBuilder for specific type of controls and specific type of elements under the name given.

Declaration

cs-api-definition
public static void RegisterControlStyleBuilder(string controlTypeName, string elementTypeName, StyleGroup builder, string themeName)

Parameters

controlTypeName

string

elementTypeName

string

builder

StyleGroup

themeName

string

RegisterDarkTheme(string)

Registers a theme as dark, by its theme name.

Declaration

cs-api-definition
public static void RegisterDarkTheme(string themeName)

Parameters

themeName

string

The name of the theme.

RegisterElementTypeDefaultStyleBuilder(string, string, StyleGroup)

Declaration

cs-api-definition
public static void RegisterElementTypeDefaultStyleBuilder(string themeName, string elementTypeName, StyleGroup builder)

Parameters

themeName

string

elementTypeName

string

builder

StyleGroup

RegisterStyleBuilder(StyleGroup, string)

Registers a StyleSheet found in styleBuilderRegistration using also the registration details specified under the theme name specified.

Declaration

cs-api-definition
public static void RegisterStyleBuilder(StyleGroup styleBuilderRegistration, string themeName)

Parameters

styleBuilderRegistration

StyleGroup

themeName

string

RegisterStyleBuilderByControlName(string, string, StyleGroup, string)

Declaration

cs-api-definition
public static void RegisterStyleBuilderByControlName(string controlName, string elementTypeName, StyleGroup builder, string themeName)

Parameters

controlName

string

elementTypeName

string

builder

StyleGroup

themeName

string

RegisterThemeFromStorage(ThemeStorageType, Assembly, string)

Registers theme from a file or resource that contains a XML-serialized Theme object. The Visual Style Builder application for example is capable of designing and serializing themes. Theme files generally contain Theme with one or several style sheets each assigned a registration that defines which RadControl and/or RadElment the style sheet applies.

Declaration

cs-api-definition
public static void RegisterThemeFromStorage(ThemeStorageType storageType, Assembly assembly, string themeLocation)

Parameters

storageType

ThemeStorageType

assembly

Assembly

themeLocation

string

RegisterThemeFromStorage(ThemeStorageType, ResourceParams)

Registers theme from a file or resource that contains a XML-serialized Theme object. The Visual Style Builder application for example is capable of designing and serializing themes. Theme files generally contain Theme with one or several style sheets each assigned a registration that defines which RadControl and/or RadElment the style sheet applies.

Declaration

cs-api-definition
public static void RegisterThemeFromStorage(ThemeStorageType storageType, ThemeResolutionService.ResourceParams resourceParams)

Parameters

storageType

ThemeStorageType

resourceParams

ThemeResolutionService.ResourceParams

RegisterThemeFromStorage(ThemeStorageType, string)

Registers theme from a file or resource that contains a XML-serialized Theme object. The Visual Style Builder application for example is capable of designing and serializing themes. Theme files generally contain Theme with one or several style sheets each assigned a registration that defines which RadControl and/or RadElment the style sheet applies.

Declaration

cs-api-definition
public static void RegisterThemeFromStorage(ThemeStorageType storageType, string themeLocation)

Parameters

storageType

ThemeStorageType

themeLocation

string

RegisterThemeRepository(XmlStyleRepository, string)

Declaration

cs-api-definition
public static void RegisterThemeRepository(XmlStyleRepository styleRepository, string themeName)

Parameters

styleRepository

XmlStyleRepository

themeName

string

RemoveThemeRegistration(string)

Declaration

cs-api-definition
public static void RemoveThemeRegistration(string themeName)

Parameters

themeName

string

ResumeThemeChange()

Resumes the ThemeChange event. This method is used internally.

Declaration

cs-api-definition
public static void ResumeThemeChange()

ResumeThemeChange(bool)

Resumes the ThemeChange event. This method is used internally.

Declaration

cs-api-definition
public static void ResumeThemeChange(bool raiseChanged)

Parameters

raiseChanged

bool

Determines whether to fire the ThemeChanged event.

SubscribeForThemeChanged(IThemeChangeListener)

Call to subscribe for theme change event, for the specified control theme class name. Note the event may be fired from another thread

Declaration

cs-api-definition
public static void SubscribeForThemeChanged(IThemeChangeListener listener)

Parameters

listener

IThemeChangeListener

SuspendThemeChange()

Suspends the ThemeChange event. This method is used internally.

Declaration

cs-api-definition
public static void SuspendThemeChange()

UnregisterStyleSheetBuilder(StyleGroup)

Removes an instance of the StyleGroup class from the dictionaries with registered style builders.

Declaration

cs-api-definition
public static void UnregisterStyleSheetBuilder(StyleGroup builder)

Parameters

builder

StyleGroup

The instance to remove.

UnsubscribeFromThemeChanged(IThemeChangeListener)

Call to unsubscribe for theme change event.

Declaration

cs-api-definition
public static void UnsubscribeFromThemeChanged(IThemeChangeListener listener)

Parameters

listener

IThemeChangeListener

Events

ApplicationThemeChanged

Declaration

cs-api-definition
public static event ThemeChangedHandler ApplicationThemeChanged

Event Value

ThemeChangedHandler

ResolveStyleBuilder

Declaration

cs-api-definition
public static event ResolveStyleBuilderEventHandler ResolveStyleBuilder

Event Value

ResolveStyleBuilderEventHandler

In this article
DefinitionConstructorsThemeResolutionService()FieldsTelerikFluentIconsFontNameTelerikWebUIFontNameWebComponentsIconsFontNamePropertiesAllowAnimationsApplicationThemeNameControlDefaultThemeNameSystemThemeNameMethodsApplyThemeToControlTree(Control, string)ClearTheme(string)EnsureThemeRegistered(string)GetAvailableThemes()GetAvailableThemes(IComponentTreeHandler)GetCustomFont(string)GetCustomFonts()GetFont(string, float, FontStyle)GetStyleSheetBuilder(IComponentTreeHandler, string, string, string)GetStyleSheetBuilder(RadElement)GetStyleSheetBuilder(RadElement, string)GetStyleSheetBuilders(string)GetTheme(string)GetThemeRepository(string, bool, bool)LoadFont(Stream)LoadFont(string)LoadPackageFile(string)LoadPackageFile(string, bool)LoadPackageResource(Assembly, string)LoadPackageResource(ResourceParams, bool)LoadPackageResource(string)RaiseThemeChanged(string, string)RegisterControlStyleBuilder(string, string, StyleGroup, string)RegisterDarkTheme(string)RegisterElementTypeDefaultStyleBuilder(string, string, StyleGroup)RegisterStyleBuilder(StyleGroup, string)RegisterStyleBuilderByControlName(string, string, StyleGroup, string)RegisterThemeFromStorage(ThemeStorageType, Assembly, string)RegisterThemeFromStorage(ThemeStorageType, ResourceParams)RegisterThemeFromStorage(ThemeStorageType, string)RegisterThemeRepository(XmlStyleRepository, string)RemoveThemeRegistration(string)ResumeThemeChange()ResumeThemeChange(bool)SubscribeForThemeChanged(IThemeChangeListener)SuspendThemeChange()UnregisterStyleSheetBuilder(StyleGroup)UnsubscribeFromThemeChanged(IThemeChangeListener)EventsApplicationThemeChangedResolveStyleBuilder
Not finding the help you need?
Contact Support