[]
        
(Showing Draft Content)

C1.Win.C1Themes.C1ThemeController

C1ThemeController Class

Represents a component that loads and manages C1 visual themes, and applies them to forms and controls.

Inheritance
C1ThemeController
Namespace: C1.Win.C1Themes
Assembly: C1.Win.C1Themes.4.8.dll
Syntax
[C1Description("C1ThemeController", "Represents a component used to load and apply themes to controls at design and runtime.")]
[ToolboxBitmap(typeof(C1ThemeController), "C1ThemeController.png")]
public class C1ThemeController : Component, IComponent, IDisposable, IExtenderProvider, ISupportInitialize

Constructors

Name Description
C1ThemeController()

Initializes a new instance of the C1ThemeController class.

Fields

Name Description
DefaultThemeName

The default theme name id.

When assigned to the Theme property of a theme controller, indicates that it should use the default application theme.

NoTheme

The empty theme name id.

When assigned to the "Theme" extender property (provided by C1ThemeController) on a control, indicates that no theme should be applied to that control by the theme controller.

Properties

Name Description
ApplicationTheme

Gets or sets the application-wide default theme name.

All theme controllers which have "(default)" set as Theme property value will use this theme.

This name is persisted with key "C1ApplicationTheme" in the application config file (app.config).

ApplicationThemeSettings

Gets or sets the application-wide default theme settings.

All theme controllers which have "(default)" set as Theme property value will use this theme settings.

This name is persisted with key "C1ApplicationThemeSettings" in the application config file (app.config).

Theme

Gets or sets the name of the default theme for all objects on the form or user control managed by the current theme controller.

ThemeSettings

Gets or sets the default theme settings for all objects on the form or user control managed by the current theme controller.

Methods

Name Description
ApplyThemeToControlTree(Control, C1Theme, Predicate<Control>, bool)

Recursively applies a theme to a control and its children. Controls that do not support themes are ignored (but the theme is applied to their children).

ApplyThemeToObject(object, C1Theme)

Applies a theme to an object.

The target object must be either a C1 control supporting themes, or a standard control (such as Button, Label etc) for which basic theming is provided by this library.

BeginInit()
Dispose(bool)

For internal use.

EndInit()
GetTheme(object)

Gets the name of a theme set on an object by this theme controller.

GetThemeByName(string, bool)

Retrieves a theme registered with the application, by its name.

GetThemeSettings(object)

Gets the theme settings of a theme set on an object by this theme controller.

GetThemes()

Retrieves the names of all themes registered with the application.

IsObjectThemeable(object)

Checks whether an object supports ComponentOne themes.

IsPreviewControlInsideC1PrintPreviewControl(object)
IsThemeRegistered(string)

Checks whether a theme with a specified name has been registered.

OnObjectThemeApplied(object, string)

Fires the ThemeChanged event.

OnObjectThemeApplying(object, string)

Fires the ObjectThemeApplying event.

OnObjectThemeChanged(object, string)

Fires the ThemeChanged event.

OnObjectThemeChanging(object, string)

Fires the ObjectThemeChanging event.

OnThemeChanged(string)

Fires the ThemeChanged event.

OnThemeChanging(string)

Fires the ThemeChanging event.

RegisterTheme(Stream)

Loads a theme from a stream, and registeres it for use by theme controllers in the application.

After this method completes, the theme can be set via ApplicationTheme and Theme properties.

his method throws an exception if a theme with same name has already been registered.

RegisterTheme(Stream, C1ThemeFormat)

Loads a theme from a stream, and registeres it for use by theme controllers in the application.

After this method completes, the theme can be set via ApplicationTheme and Theme properties.

his method throws an exception if a theme with same name has already been registered.

RegisterTheme(string)

Loads a theme from a file, and registeres it for use by theme controllers in the application.

After this method completes, the theme can be set via ApplicationTheme and Theme properties.

his method throws an exception if a theme with same name has already been registered.

RegisterThemes(Assembly)

Loads all themes from an assembly, and registeres them for use by theme controllers in the current application.

This method scans all resources in the specified assembly, and selects those with names ending in ".c1theme" (case insensitive). If a theme cannot be loaded (e.g. due to a duplicate name or other error), it is skipped (i.e. no exception is thrown).

ResetTheme()

For internal use.

ResetThemeSettings()
SetTheme(object, string)

Sets a theme name on an object.

SetThemeSettings(object, C1ThemeSettings)

Sets a theme settings on an object.

ShouldSerializeTheme()

For internal use.

ShouldSerializeThemeSettings()
UnregisterTheme(string)

Unregisters the theme with a specified name.

This method does nothing if a matching theme could not be found.

An exception is thrown if the specified theme is currently in use.

Events

Name Description
ApplicationThemeChanged

Occurs after a new value has been assigned to the ApplicationTheme property.

ApplicationThemeChanging

Occurs before a new value is assigned to the ApplicationTheme property.

ObjectThemeApplied

Occurs after a theme has been applied to an object managed by the current theme controller.

See remarks for details.

ObjectThemeApplying

Occurs when a theme is about to be applied to an object managed by the current theme controller.

See remarks in ObjectThemeApplied for details.

ObjectThemeChanged

Occurs after a theme on an object managed by the current theme controller has been changed.

See remarks in ObjectThemeApplied for details.

ObjectThemeChanging

Occurs when a theme on an object managed by the current theme controller is about to be changed.

See remarks in ObjectThemeApplied for details.

ThemeChanged

Occurs after a new value has been assigned to the Theme property.

ThemeChanging

Occurs before a new value is assigned to the Theme property.