Class ThemeResolutionService
A Class that represents storage for themes in an application that contains RadControls.
Inheritance
Inherited Members
Namespace: Telerik.WinControls
Assembly: Telerik.WinControls.dll
Syntax
public class ThemeResolutionService
Remarks
A theme consists of one or more StyleSheet objects, and one or more StyleSheetRelation objects.
The style sheet object defines the appearance and/or certain aspects of behavior of one RadControl or RadItem.
StyleSheetRelation objects contain data that maps a control and a certain StyleSheet.
Theme.ThemeName is used by RadControl to automatically query ThemeResolutionService, upon Initialize and retrieve its StyleSheet. Use the API of this class to register, un-register, query themes storage for specific themes by attributes like Name, certain relations, etc.
Constructors
ThemeResolutionService()
Declaration
public ThemeResolutionService()
Fields
TelerikFluentIconsFontName
Declaration
public static string TelerikFluentIconsFontName
Field Value
System.
|
TelerikWebUIFontName
Declaration
public static string TelerikWebUIFontName
Field Value
System.
|
WebComponentsIconsFontName
Declaration
public static string WebComponentsIconsFontName
Field Value
System.
|
Properties
AllowAnimations
Determines whether animations are allowed across entire application.
Declaration
public static bool AllowAnimations { get; set; }
Property Value
System.
|
ApplicationThemeName
Gets or sets value indicating the theme name that will be used by all controls in the application.
Declaration
public static string ApplicationThemeName { get; set; }
Property Value
System.
|
Remarks
If the value of this property is null or empty each control will be assigned a theme, corresponding on the
Theme
ControlDefaultThemeName
"ControlDefault" theme name
Declaration
public static string ControlDefaultThemeName { get; set; }
Property Value
System.
|
SystemThemeName
Declaration
public static string SystemThemeName { get; }
Property Value
System.
|
Methods
ApplyThemeToControlTree(Control, String)
Applies the specified ThemeName to all RadControls that are children of the specified Control and its child Controls
Declaration
public static void ApplyThemeToControlTree(Control control, string themeName)
Parameters
System.
|
System.
|
ClearTheme(String)
Clears all stylesheets registered previously with the themeName specified.
Declaration
public static void ClearTheme(string themeName)
Parameters
System.
|
EnsureThemeRegistered(String)
Creates and registers an empty Theme if one is not already registered.
Declaration
public static Theme EnsureThemeRegistered(string themeName)
Parameters
System.
|
Returns
GetAvailableThemes()
Gets a list of all registered themes.
Declaration
public static ICollection GetAvailableThemes()
Returns
System.
|
GetAvailableThemes(IComponentTreeHandler)
Gets any themes registered for a specific control by control type name or control name.
Declaration
public static List<Theme> GetAvailableThemes(IComponentTreeHandler control)
Parameters
IComponent
|
Returns
System.
|
GetCustomFont(String)
Returns a previously loaded font by given font name.
Declaration
public static FontFamily GetCustomFont(string fontName)
Parameters
System. The name of font. |
Returns
System. The FontFamily or null if font with given name is not loaded. |
GetCustomFonts()
Declaration
public static FontFamily[] GetCustomFonts()
Returns
System.
|
GetFont(String, Single, FontStyle)
Returns a font by given font name. The font can be custom(loaded in memory) or installed on the machine.
Declaration
public static Font GetFont(string fontName, float fontSize, FontStyle fontStyle)
Parameters
System. The name of the font or custom font. |
System. The size of the font. |
System.
|
Returns
System. The Font or the default font if font with given name is not valid. |
GetStyleSheetBuilder(IComponentTreeHandler, String, String, String)
Declaration
public static StyleGroup GetStyleSheetBuilder(IComponentTreeHandler control, string elementTypeFullName, string elementName, string proposedThemeName)
Parameters
IComponent
|
System.
|
System.
|
System.
|
Returns
GetStyleSheetBuilder(RadElement)
Declaration
public static StyleGroup GetStyleSheetBuilder(RadElement element)
Parameters
Rad
|
Returns
GetStyleSheetBuilder(RadElement, String)
Declaration
public static StyleGroup GetStyleSheetBuilder(RadElement element, string proposedThemeName)
Parameters
Rad
|
System.
|
Returns
GetStyleSheetBuilders(String)
Gets all StyleSheets registered under a theme name.
Declaration
public static StyleGroup[] GetStyleSheetBuilders(string themeName)
Parameters
System.
|
Returns
GetTheme(String)
Get previously registered theme by theme name.
Declaration
public static Theme GetTheme(string themeName)
Parameters
System.
|
Returns
GetThemeRepository(String, Boolean, Boolean)
Declaration
public static XmlStyleRepository GetThemeRepository(string themeName, bool useAsterikTheme, bool useAppThemeName)
Parameters
System.
|
System.
|
System.
|
Returns
LoadFont(Stream)
Declaration
public static int LoadFont(Stream fontStream)
Parameters
System.
|
Returns
System.
|
LoadFont(String)
Declaration
public static int LoadFont(string resourcePath)
Parameters
System.
|
Returns
System.
|
LoadPackageFile(String)
Loads a theme package, stored in the provided file.
Declaration
public static bool LoadPackageFile(string filePath)
Parameters
System.
|
Returns
System.
|
LoadPackageFile(String, Boolean)
Loads a theme package stored in the provided file.
Declaration
public static bool LoadPackageFile(string filePath, bool throwOnError)
Parameters
System.
|
System. True to throw an exception if it occurs, false otherwise. |
Returns
System.
|
LoadPackageResource(Assembly, String)
Loads a theme package from an embedded resource in the specified assembly.
Declaration
public static bool LoadPackageResource(Assembly sourceAssembly, string resourcePath)
Parameters
System.
|
System.
|
Returns
System.
|
LoadPackageResource(String)
Loads a theme package, stored in the provided embedded resource. The calling assembly is used to read the manifest resource stream.
Declaration
public static bool LoadPackageResource(string resourcePath)
Parameters
System.
|
Returns
System.
|
LoadPackageResource(ThemeResolutionService.ResourceParams, Boolean)
Loads a theme package stored in the provided embedded resource.
Declaration
public static bool LoadPackageResource(ThemeResolutionService.ResourceParams resourceParams, bool throwOnError)
Parameters
Theme
|
System. True to throw an exception if it occurs, false otherwise. |
Returns
System.
|
RaiseThemeChanged(String, String)
Declaration
public static void RaiseThemeChanged(string themeName, string controlThemeClassName)
Parameters
System.
|
System.
|
RegisterControlStyleBuilder(String, String, StyleGroup, String)
Registers a StyleBuilder for specific type of controls and specific type of elements under the name given.
Declaration
public static void RegisterControlStyleBuilder(string controlTypeName, string elementTypeName, StyleGroup builder, string themeName)
Parameters
System.
|
System.
|
Style
|
System.
|
RegisterDarkTheme(String)
Registers a theme as dark, by its theme name.
Declaration
public static void RegisterDarkTheme(string themeName)
Parameters
System. The name of the theme. |
RegisterElementTypeDefaultStyleBuilder(String, String, StyleGroup)
Declaration
public static void RegisterElementTypeDefaultStyleBuilder(string themeName, string elementTypeName, StyleGroup builder)
Parameters
System.
|
System.
|
Style
|
RegisterStyleBuilder(StyleGroup, String)
Registers a StyleSheet found in styleBuilderRegistration using also the registration details specified under the theme name specified.
Declaration
public static void RegisterStyleBuilder(StyleGroup styleBuilderRegistration, string themeName)
Parameters
Style
|
System.
|
RegisterStyleBuilderByControlName(String, String, StyleGroup, String)
Declaration
public static void RegisterStyleBuilderByControlName(string controlName, string elementTypeName, StyleGroup builder, string themeName)
Parameters
System.
|
System.
|
Style
|
System.
|
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
public static void RegisterThemeFromStorage(ThemeStorageType storageType, Assembly assembly, string themeLocation)
Parameters
Theme
|
System.
|
System.
|
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
public static void RegisterThemeFromStorage(ThemeStorageType storageType, string themeLocation)
Parameters
Theme
|
System.
|
RegisterThemeFromStorage(ThemeStorageType, ThemeResolutionService.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
public static void RegisterThemeFromStorage(ThemeStorageType storageType, ThemeResolutionService.ResourceParams resourceParams)
Parameters
Theme
|
Theme
|
RegisterThemeRepository(XmlStyleRepository, String)
Declaration
public static void RegisterThemeRepository(XmlStyleRepository styleRepository, string themeName)
Parameters
Xml
|
System.
|
RemoveThemeRegistration(String)
Declaration
public static void RemoveThemeRegistration(string themeName)
Parameters
System.
|
ResumeThemeChange()
Resumes the ThemeChange event. This method is used internally.
Declaration
public static void ResumeThemeChange()
ResumeThemeChange(Boolean)
Resumes the ThemeChange event. This method is used internally.
Declaration
public static void ResumeThemeChange(bool raiseChanged)
Parameters
System. 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
public static void SubscribeForThemeChanged(IThemeChangeListener listener)
Parameters
ITheme
|
SuspendThemeChange()
Suspends the ThemeChange event. This method is used internally.
Declaration
public static void SuspendThemeChange()
UnregisterStyleSheetBuilder(StyleGroup)
Removes an instance of the Style
Declaration
public static void UnregisterStyleSheetBuilder(StyleGroup builder)
Parameters
Style The instance to remove. |
UnsubscribeFromThemeChanged(IThemeChangeListener)
Call to unsubscribe for theme change event.
Declaration
public static void UnsubscribeFromThemeChanged(IThemeChangeListener listener)
Parameters
ITheme
|
Events
ApplicationThemeChanged
Declaration
public static event ThemeChangedHandler ApplicationThemeChanged
Event Type
ResolveStyleBuilder
Declaration
public static event ResolveStyleBuilderEventHandler ResolveStyleBuilder