New to Telerik UI for WinFormsStart a free 30-day trial

Provides centralized theme management and resolution services for RadControls applications.

Definition

Namespace:Telerik.WinControls

Assembly:Telerik.WinControls.dll

Syntax:

C#
public class ThemeResolutionService

Inheritance: objectThemeResolutionService

Constructors

C#
public ThemeResolutionService()

Fields

C#
public static string TelerikFluentIconsFontName
C#
public static string TelerikWebUIFontName
C#
public static string WebComponentsIconsFontName

Properties

Determines whether animations are allowed across entire application.

C#
public static bool AllowAnimations { get; set; }

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

C#
public static string ApplicationThemeName { get; set; }
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.

"ControlDefault" theme name

C#
public static string ControlDefaultThemeName { get; set; }
C#
public static string SystemThemeName { get; }

Methods

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

C#
public static void ApplyThemeToControlTree(Control control, string themeName)
Parameters:controlControlthemeNamestring

Clears all stylesheets registered previously with the themeName specified.

C#
public static void ClearTheme(string themeName)
Parameters:themeNamestring

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

C#
public static Theme EnsureThemeRegistered(string themeName)
Parameters:themeNamestringReturns:

Theme

Gets a list of all registered themes.

C#
public static ICollection GetAvailableThemes()
Returns:

ICollection

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

C#
public static List<Theme> GetAvailableThemes(IComponentTreeHandler control)
Parameters:controlIComponentTreeHandlerReturns:

List<Theme>

Returns a previously loaded font by given font name.

C#
public static FontFamily GetCustomFont(string fontName)
Parameters:fontNamestring

The name of font.

Returns:

FontFamily

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

C#
public static FontFamily[] GetCustomFonts()
Returns:

FontFamily[]

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

C#
public static Font GetFont(string fontName, float fontSize, FontStyle fontStyle)
Parameters:fontNamestring

The name of the font or custom font.

fontSizefloat

The size of the font.

fontStyleFontStyle
Returns:

Font

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

C#
public static StyleGroup GetStyleSheetBuilder(IComponentTreeHandler control, string elementTypeFullName, string elementName, string proposedThemeName)
Parameters:controlIComponentTreeHandlerelementTypeFullNamestringelementNamestringproposedThemeNamestringReturns:

StyleGroup

C#
public static StyleGroup GetStyleSheetBuilder(RadElement element, string proposedThemeName)
Parameters:elementRadElementproposedThemeNamestringReturns:

StyleGroup

C#
public static StyleGroup GetStyleSheetBuilder(RadElement element)
Parameters:elementRadElementReturns:

StyleGroup

Gets all StyleSheets registered under a theme name.

C#
public static StyleGroup[] GetStyleSheetBuilders(string themeName)
Parameters:themeNamestringReturns:

StyleGroup[]

Get previously registered theme by theme name.

C#
public static Theme GetTheme(string themeName)
Parameters:themeNamestringReturns:

Theme

C#
public static XmlStyleRepository GetThemeRepository(string themeName, bool useAsterikTheme, bool useAppThemeName)
Parameters:themeNamestringuseAsterikThemebooluseAppThemeNameboolReturns:

XmlStyleRepository

C#
public static int LoadFont(Stream fontStream)
Parameters:fontStreamStreamReturns:

int

C#
public static int LoadFont(string resourcePath)
Parameters:resourcePathstringReturns:

int

Loads a theme package stored in the provided file.

C#
public static bool LoadPackageFile(string filePath, bool throwOnError)
Parameters:filePathstringthrowOnErrorbool

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

Returns:

bool

Loads a theme package, stored in the provided file.

C#
public static bool LoadPackageFile(string filePath)
Parameters:filePathstringReturns:

bool

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

C#
public static bool LoadPackageResource(Assembly sourceAssembly, string resourcePath)
Parameters:sourceAssemblyAssemblyresourcePathstringReturns:

bool

Loads a theme package stored in the provided embedded resource.

C#
public static bool LoadPackageResource(ThemeResolutionService.ResourceParams resourceParams, bool throwOnError)
Parameters:resourceParamsThemeResolutionService.ResourceParamsthrowOnErrorbool

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

Returns:

bool

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

C#
public static bool LoadPackageResource(string resourcePath)
Parameters:resourcePathstringReturns:

bool

C#
public static void RaiseThemeChanged(string themeName, string controlThemeClassName)
Parameters:themeNamestringcontrolThemeClassNamestring

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

C#
public static void RegisterControlStyleBuilder(string controlTypeName, string elementTypeName, StyleGroup builder, string themeName)
Parameters:controlTypeNamestringelementTypeNamestringbuilderStyleGroupthemeNamestring

Registers a theme as dark, by its theme name.

C#
public static void RegisterDarkTheme(string themeName)
Parameters:themeNamestring

The name of the theme.

C#
public static void RegisterElementTypeDefaultStyleBuilder(string themeName, string elementTypeName, StyleGroup builder)
Parameters:themeNamestringelementTypeNamestringbuilderStyleGroup

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

C#
public static void RegisterStyleBuilder(StyleGroup styleBuilderRegistration, string themeName)
Parameters:styleBuilderRegistrationStyleGroupthemeNamestring
C#
public static void RegisterStyleBuilderByControlName(string controlName, string elementTypeName, StyleGroup builder, string themeName)
Parameters:controlNamestringelementTypeNamestringbuilderStyleGroupthemeNamestring

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.

C#
public static void RegisterThemeFromStorage(ThemeStorageType storageType, Assembly assembly, string themeLocation)
Parameters:storageTypeThemeStorageTypeassemblyAssemblythemeLocationstring

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.

C#
public static void RegisterThemeFromStorage(ThemeStorageType storageType, ThemeResolutionService.ResourceParams resourceParams)
Parameters:storageTypeThemeStorageTyperesourceParamsThemeResolutionService.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.

C#
public static void RegisterThemeFromStorage(ThemeStorageType storageType, string themeLocation)
Parameters:storageTypeThemeStorageTypethemeLocationstring
C#
public static void RegisterThemeRepository(XmlStyleRepository styleRepository, string themeName)
Parameters:styleRepositoryXmlStyleRepositorythemeNamestring
C#
public static void RemoveThemeRegistration(string themeName)
Parameters:themeNamestring

Resumes the ThemeChange event. This method is used internally.

C#
public static void ResumeThemeChange()

Resumes the ThemeChange event. This method is used internally.

C#
public static void ResumeThemeChange(bool raiseChanged)
Parameters:raiseChangedbool

Determines whether to fire the ThemeChanged event.

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

C#
public static void SubscribeForThemeChanged(IThemeChangeListener listener)
Parameters:listenerIThemeChangeListener

Suspends the ThemeChange event. This method is used internally.

C#
public static void SuspendThemeChange()

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

C#
public static void UnregisterStyleSheetBuilder(StyleGroup builder)
Parameters:builderStyleGroup

The instance to remove.

Call to unsubscribe for theme change event.

C#
public static void UnsubscribeFromThemeChanged(IThemeChangeListener listener)
Parameters:listenerIThemeChangeListener

Events

C#
public static event ThemeChangedHandler ApplicationThemeChanged
C#
public static event ResolveStyleBuilderEventHandler ResolveStyleBuilder
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, string)GetStyleSheetBuilder(RadElement)GetStyleSheetBuilders(string)GetTheme(string)GetThemeRepository(string, bool, bool)LoadFont(Stream)LoadFont(string)LoadPackageFile(string, bool)LoadPackageFile(string)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