Class RadThemeComponentBase
Base class used by RadThemeManager to recognize classes that load themes from resources in a class library. This abstract class provides the foundation for theme components that can load and manage visual themes.
Inheritance
Namespace: Telerik.WinControls
Assembly: Telerik.WinControls.dll
Syntax
public abstract class RadThemeComponentBase : Component
Remarks
RadThemeComponentBase serves as the base class for all theme components in the Telerik WinControls suite. It provides infrastructure for loading themes from embedded resources, managing theme lifecycle, and integrating with the design-time environment. Theme components inheriting from this class are automatically recognized by the RadThemeManager and can participate in the theming system.
Constructors
RadThemeComponentBase()
Initializes a new instance of the RadThemeComponentBase class.
Declaration
public RadThemeComponentBase()
Properties
IsDesignMode
Gets a value indicating whether the component is currently in design mode.
Declaration
public bool IsDesignMode { get; }
Property Value
System.Boolean
|
Remarks
This property is used to determine if the component is being used in a design-time environment such as Visual Studio's form designer.
Site
Gets or sets the site of the component.
Declaration
public override ISite Site { get; set; }
Property Value
System.ComponentModel.ISite
The System.ComponentModel.ISite associated with the component. |
Remarks
When the site is set in design mode, this triggers the theme loading process if the theme is not already available in the repository.
ThemeName
Gets the name of the theme provided by this component.
Declaration
public virtual string ThemeName { get; }
Property Value
System.String
The theme name, or an empty string if no theme name is specified. |
Remarks
This property is used by the theming system to identify and reference the theme. Derived classes should override this property to return the actual theme name.
Methods
CreateContext(Control)
Creates a theme context for the specified control. This method is used internally by the theming system.
Declaration
public static RadThemeComponentBase.ThemeContext CreateContext(Control control)
Parameters
System.Windows.Forms.Control
control
The control to create a context for. |
Returns
RadThemeComponentBase.ThemeContext
A RadThemeComponentBase.ThemeContext instance for the specified control. |
Remarks
This method creates a ThemeContext that can be used to save and restore control states during theme operations.
DeserializeTheme()
Deserializes the theme associated with this component. Override this method to provide custom theme deserialization logic.
Declaration
public virtual void DeserializeTheme()
Remarks
This method is called during the theme loading process to deserialize theme data from its stored format. The default implementation does nothing.
Dispose(Boolean)
Releases the unmanaged resources used by the RadThemeComponentBase and optionally releases the managed resources.
Declaration
protected override void Dispose(bool disposing)
Parameters
System.Boolean
disposing
|
Remarks
This method removes the theme from the repository when the component is disposed in design mode.
Load()
Loads the theme associated with this component. Derived classes must implement this method to provide the theme loading logic.
Declaration
public abstract void Load()
Remarks
This method is called to load the theme into the theme repository. Implementations should load theme data from embedded resources or other sources and register the theme with the ThemeRepository.
LoadResource(Assembly, String)
Loads a theme resource from the specified assembly and resource path.
Declaration
protected virtual bool LoadResource(Assembly resourceAssembly, string resourcePath)
Parameters
System.Reflection.Assembly
resourceAssembly
The assembly containing the theme resource. |
System.String
resourcePath
The path to the theme resource within the assembly. |
Returns
System.Boolean
|
Remarks
This method loads a theme from an embedded resource, deserializes it using a TSSPThemeReader, and adds it to the ThemeRepository. If loading fails, an error message is displayed.
RemoveThemeCore()
Removes the theme from the theme repository. Override this method to provide custom theme removal logic.
Declaration
protected virtual void RemoveThemeCore()
Remarks
This method is called during component disposal to clean up the theme from the theme repository. The default implementation removes the theme by name.