ClassThemeResolutionService
Provides centralized theme management and resolution services for RadControls applications.
Definition
Namespace:Telerik.WinControls
Assembly:Telerik.WinControls.dll
Syntax:
public class ThemeResolutionService
Inheritance: objectThemeResolutionService
Constructors
ThemeResolutionService()
Declaration
public ThemeResolutionService()
Fields
Properties
AllowAnimations
Determines whether animations are allowed across entire application.
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
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
public static string ControlDefaultThemeName { get; set; }
Property Value
Methods
ApplyThemeToControlTree(Control, string)
Applies the specified ThemeName to all RadControls that are children of the specified Control and its child Controls
ClearTheme(string)
Clears all stylesheets registered previously with the themeName specified.
Declaration
public static void ClearTheme(string themeName)
Parameters
themeName
EnsureThemeRegistered(string)
Creates and registers an empty Theme if one is not already registered.
GetAvailableThemes()
Gets a list of all registered themes.
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
control
Returns
List<Theme>
GetCustomFont(string)
Returns a previously loaded font by given font name.
Declaration
public static FontFamily GetCustomFont(string fontName)
Parameters
fontName
The name of font.
Returns
The FontFamily or null if font with given name is not loaded.
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
public static Font GetFont(string fontName, float fontSize, FontStyle fontStyle)
Parameters
fontName
The name of the font or custom font.
fontSize
The size of the font.
fontStyle
Returns
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
control
elementTypeFullName
elementName
proposedThemeName
Returns
GetStyleSheetBuilder(RadElement)
Declaration
public static StyleGroup GetStyleSheetBuilder(RadElement element)
Parameters
element
Returns
GetStyleSheetBuilder(RadElement, string)
Declaration
public static StyleGroup GetStyleSheetBuilder(RadElement element, string proposedThemeName)
Parameters
element
proposedThemeName
Returns
GetStyleSheetBuilders(string)
Gets all StyleSheets registered under a theme name.
Declaration
public static StyleGroup[] GetStyleSheetBuilders(string themeName)
Parameters
themeName
Returns
GetTheme(string)
Get previously registered theme by theme name.
LoadPackageFile(string)
Loads a theme package, stored in the provided file.
LoadPackageFile(string, bool)
Loads a theme package stored in the provided file.
LoadPackageResource(Assembly, string)
Loads a theme package from an embedded resource in the specified assembly.
LoadPackageResource(ResourceParams, bool)
Loads a theme package stored in the provided embedded resource.
Declaration
public static bool LoadPackageResource(ThemeResolutionService.ResourceParams resourceParams, bool throwOnError)
Parameters
resourceParams
ThemeResolutionService.ResourceParams
throwOnError
True to throw an exception if it occurs, false otherwise.
Returns
LoadPackageResource(string)
Loads a theme package, stored in the provided embedded resource. The calling assembly is used to read the manifest resource stream.
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
controlTypeName
elementTypeName
builder
themeName
RegisterDarkTheme(string)
Registers a theme as dark, by its theme name.
Declaration
public static void RegisterDarkTheme(string themeName)
Parameters
themeName
The name of the theme.
RegisterElementTypeDefaultStyleBuilder(string, string, StyleGroup)
Declaration
public static void RegisterElementTypeDefaultStyleBuilder(string themeName, string elementTypeName, StyleGroup builder)
Parameters
themeName
elementTypeName
builder
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
styleBuilderRegistration
themeName
RegisterStyleBuilderByControlName(string, string, StyleGroup, string)
Declaration
public static void RegisterStyleBuilderByControlName(string controlName, string elementTypeName, StyleGroup builder, string themeName)
Parameters
controlName
elementTypeName
builder
themeName
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
storageType
assembly
themeLocation
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
public static void RegisterThemeFromStorage(ThemeStorageType storageType, ThemeResolutionService.ResourceParams resourceParams)
Parameters
storageType
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
public static void RegisterThemeFromStorage(ThemeStorageType storageType, string themeLocation)
Parameters
storageType
themeLocation
RegisterThemeRepository(XmlStyleRepository, string)
Declaration
public static void RegisterThemeRepository(XmlStyleRepository styleRepository, string themeName)
Parameters
styleRepository
XmlStyleRepository
themeName
RemoveThemeRegistration(string)
Declaration
public static void RemoveThemeRegistration(string themeName)
Parameters
themeName
ResumeThemeChange()
Resumes the ThemeChange event. This method is used internally.
Declaration
public static void ResumeThemeChange()
ResumeThemeChange(bool)
Resumes the ThemeChange event. This method is used internally.
Declaration
public static void ResumeThemeChange(bool raiseChanged)
Parameters
raiseChanged
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
listener
SuspendThemeChange()
Suspends the ThemeChange event. This method is used internally.
Declaration
public static void SuspendThemeChange()
UnregisterStyleSheetBuilder(StyleGroup)
Removes an instance of the StyleGroup class from the dictionaries with registered style builders.
Declaration
public static void UnregisterStyleSheetBuilder(StyleGroup builder)
Parameters
builder
The instance to remove.
UnsubscribeFromThemeChanged(IThemeChangeListener)
Call to unsubscribe for theme change event.
Declaration
public static void UnsubscribeFromThemeChanged(IThemeChangeListener listener)
Parameters
listener
Events
ApplicationThemeChanged
Declaration
public static event ThemeChangedHandler ApplicationThemeChanged
Event Value
ResolveStyleBuilder
Declaration
public static event ResolveStyleBuilderEventHandler ResolveStyleBuilder
Event Value