skip navigation
  • Product Bundles

    DevCraft

    All Telerik .NET tools and Kendo UI JavaScript components in one package. Now enhanced with:

    • NEW: Design Kits for Figma
    • Online Training
    • Document Processing Library
    • Embedded Reporting for web and desktop

    Web

    Kendo UI UI for jQuery UI for Angular UI for React UI for Vue UI for Blazor UI for ASP.NET Core UI for ASP.NET MVC UI for ASP.NET AJAX

    Mobile

    UI for .NET MAUI

    Document Management

    Telerik Document Processing

    Desktop

    UI for .NET MAUI UI for WinUI UI for WinForms UI for WPF

    Reporting

    Telerik Reporting Telerik Report Server

    Testing & Mocking

    Test Studio Test Studio Dev Edition Telerik JustMock

    CMS

    Sitefinity

    UI/UX Tools

    ThemeBuilder Design System Kit Templates and Building Blocks

    Debugging

    Fiddler Fiddler Everywhere Fiddler Classic Fiddler Everywhere Reporter FiddlerCore

    Free Tools

    VB.NET to C# Converter Testing Framework
    View all products
  • Overview
  • Demos
    • What's New
    • Roadmap
    • Release History
  • Support and Learning

    • Support and Learning Hub
    • First Steps
    • Docs
    • Demos
    • Virtual Classroom
    • Forums
    • Videos
    • Blogs
    • Accessibility
    • Submit a Ticket

    Productivity and Design Tools

    • Visual Studio Extensions
    • Visual Studio Templates
    • Embedded Reporting
  • Pricing
  • Shopping cart
    • Account Overview
    • Your Licenses
    • Downloads
    • Support Center
    • Forum Profile
    • Payment Methods
    • Edit Profile
    • Log out
  • Login
  • Contact Us
  • Try now

Class ThemeResolutionService

A Class that represents storage for themes in an application that contains RadControls.

Inheritance
System.Object
ThemeResolutionService
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
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.String

TelerikWebUIFontName

Declaration
public static string TelerikWebUIFontName
Field Value
System.String

WebComponentsIconsFontName

Declaration
public static string WebComponentsIconsFontName
Field Value
System.String

Properties

AllowAnimations

Determines whether animations are allowed across entire application.

Declaration
public static bool AllowAnimations { get; set; }
Property Value
System.Boolean

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.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
public static string ControlDefaultThemeName { get; set; }
Property Value
System.String

SystemThemeName

Declaration
public static string SystemThemeName { get; }
Property Value
System.String

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.Windows.Forms.Control control

System.String themeName

ClearTheme(String)

Clears all stylesheets registered previously with the themeName specified.

Declaration
public static void ClearTheme(string themeName)
Parameters
System.String themeName

EnsureThemeRegistered(String)

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

Declaration
public static Theme EnsureThemeRegistered(string themeName)
Parameters
System.String themeName

Returns
Theme

GetAvailableThemes()

Gets a list of all registered themes.

Declaration
public static ICollection GetAvailableThemes()
Returns
System.Collections.ICollection

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
IComponentTreeHandler control

Returns
System.Collections.Generic.List<Theme>

GetCustomFont(String)

Returns a previously loaded font by given font name.

Declaration
public static FontFamily GetCustomFont(string fontName)
Parameters
System.String fontName

The name of font.

Returns
System.Drawing.FontFamily

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

GetCustomFonts()

Declaration
public static FontFamily[] GetCustomFonts()
Returns
System.Drawing.FontFamily[]

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.String fontName

The name of the font or custom font.

System.Single fontSize

The size of the font.

System.Drawing.FontStyle fontStyle

Returns
System.Drawing.Font

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
IComponentTreeHandler control

System.String elementTypeFullName

System.String elementName

System.String proposedThemeName

Returns
StyleGroup

GetStyleSheetBuilder(RadElement)

Declaration
public static StyleGroup GetStyleSheetBuilder(RadElement element)
Parameters
RadElement element

Returns
StyleGroup

GetStyleSheetBuilder(RadElement, String)

Declaration
public static StyleGroup GetStyleSheetBuilder(RadElement element, string proposedThemeName)
Parameters
RadElement element

System.String proposedThemeName

Returns
StyleGroup

GetStyleSheetBuilders(String)

Gets all StyleSheets registered under a theme name.

Declaration
public static StyleGroup[] GetStyleSheetBuilders(string themeName)
Parameters
System.String themeName

Returns
StyleGroup[]

GetTheme(String)

Get previously registered theme by theme name.

Declaration
public static Theme GetTheme(string themeName)
Parameters
System.String themeName

Returns
Theme

GetThemeRepository(String, Boolean, Boolean)

Declaration
public static XmlStyleRepository GetThemeRepository(string themeName, bool useAsterikTheme, bool useAppThemeName)
Parameters
System.String themeName

System.Boolean useAsterikTheme

System.Boolean useAppThemeName

Returns
XmlStyleRepository

LoadFont(Stream)

Declaration
public static int LoadFont(Stream fontStream)
Parameters
System.IO.Stream fontStream

Returns
System.Int32

LoadFont(String)

Declaration
public static int LoadFont(string resourcePath)
Parameters
System.String resourcePath

Returns
System.Int32

LoadPackageFile(String)

Loads a theme package, stored in the provided file.

Declaration
public static bool LoadPackageFile(string filePath)
Parameters
System.String filePath

Returns
System.Boolean

LoadPackageFile(String, Boolean)

Loads a theme package stored in the provided file.

Declaration
public static bool LoadPackageFile(string filePath, bool throwOnError)
Parameters
System.String filePath

System.Boolean throwOnError

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

Returns
System.Boolean

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.Reflection.Assembly sourceAssembly

System.String resourcePath

Returns
System.Boolean

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.String resourcePath

Returns
System.Boolean

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
ThemeResolutionService.ResourceParams resourceParams

System.Boolean throwOnError

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

Returns
System.Boolean

RaiseThemeChanged(String, String)

Declaration
public static void RaiseThemeChanged(string themeName, string controlThemeClassName)
Parameters
System.String themeName

System.String controlThemeClassName

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.String controlTypeName

System.String elementTypeName

StyleGroup builder

System.String themeName

RegisterDarkTheme(String)

Registers a theme as dark, by its theme name.

Declaration
public static void RegisterDarkTheme(string themeName)
Parameters
System.String themeName

The name of the theme.

RegisterElementTypeDefaultStyleBuilder(String, String, StyleGroup)

Declaration
public static void RegisterElementTypeDefaultStyleBuilder(string themeName, string elementTypeName, StyleGroup builder)
Parameters
System.String themeName

System.String elementTypeName

StyleGroup 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
StyleGroup styleBuilderRegistration

System.String themeName

RegisterStyleBuilderByControlName(String, String, StyleGroup, String)

Declaration
public static void RegisterStyleBuilderByControlName(string controlName, string elementTypeName, StyleGroup builder, string themeName)
Parameters
System.String controlName

System.String elementTypeName

StyleGroup builder

System.String 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
ThemeStorageType storageType

System.Reflection.Assembly assembly

System.String themeLocation

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
ThemeStorageType storageType

System.String themeLocation

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
ThemeStorageType storageType

ThemeResolutionService.ResourceParams resourceParams

RegisterThemeRepository(XmlStyleRepository, String)

Declaration
public static void RegisterThemeRepository(XmlStyleRepository styleRepository, string themeName)
Parameters
XmlStyleRepository styleRepository

System.String themeName

RemoveThemeRegistration(String)

Declaration
public static void RemoveThemeRegistration(string themeName)
Parameters
System.String themeName

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.Boolean 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
IThemeChangeListener 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
StyleGroup builder

The instance to remove.

UnsubscribeFromThemeChanged(IThemeChangeListener)

Call to unsubscribe for theme change event.

Declaration
public static void UnsubscribeFromThemeChanged(IThemeChangeListener listener)
Parameters
IThemeChangeListener listener

Events

ApplicationThemeChanged

Declaration
public static event ThemeChangedHandler ApplicationThemeChanged
Event Type
ThemeChangedHandler

ResolveStyleBuilder

Declaration
public static event ResolveStyleBuilderEventHandler ResolveStyleBuilder
Event Type
ResolveStyleBuilderEventHandler

Extension Methods

SvgExtentions.Traverse<T>(T, Func<T, IEnumerable<T>>)
SvgExtentions.TraverseDepthFirst<T>(T, Func<T, IEnumerable<T>>)
Getting Started
  • Install Now
  • Demos
  • Step-by-Step Tutorial
  • Sample Applications
  • SDK Samples
  • Visual Studio Extensions
Support Resources
  • Code Library
  • Knowledge Base
  • Videos
Community
  • Forums
  • Blogs
  • Feedback Portal
  • Document Processing Feedback Portal

Copyright © 2018 Progress Software Corporation and/or its subsidiaries or affiliates.
All Rights Reserved.

Progress, Telerik, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries. See Trademarks for appropriate markings.