ClassRadThemeComponentBase
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.
Definition
Namespace:Telerik.WinControls
Assembly:Telerik.WinControls.dll
Syntax:
public abstract class RadThemeComponentBase : Component, IComponent, IDisposable
Inheritance: objectMarshalByRefObjectComponentRadThemeComponentBase
Derived Classes:
Implements:
Inherited Members
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
true if the component is in design mode; otherwise, false.
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.
ThemeName
Gets the name of the theme provided by this component.
Declaration
public virtual string ThemeName { get; }
Property Value
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
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(bool)
Releases the unmanaged resources used by the RadThemeComponentBase and optionally releases the managed resources.
Declaration
protected override void Dispose(bool disposing)
Parameters
disposing
true to release both managed and unmanaged resources; false to release only unmanaged resources.
Overrides
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
resourceAssembly
The assembly containing the theme resource.
resourcePath
The path to the theme resource within the assembly.
Returns
true if the resource was loaded successfully; otherwise, false.
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.