Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Collapse]WinForms Controls
  Prerequisites
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications and Dialogs
  [Collapse]Editors and Simple Controls
    Templated ListBox Items
   [Collapse]Simple Editors
    [Expand]Included Components
    [Expand]Editors Structure
    [Collapse]Editors Features
      Text Editing Overview
     [Expand]Mask Editors Overview
     [Expand]Formatting and Parsing Values
     [Expand]Editor Buttons Overview
     [Expand]Dropdown Editors Overview
      Image Editing Menu
     [Expand]Data Binding Overview
     [Collapse]Appearance Customization
       Look And Feel and Skin Support
       Appearance Settings
       Style Controller
       Border and Button Styles
     [Expand]Miscellaneous Features
    [Expand]Member Tables
    [Expand]Examples
   [Expand]Lookup Editors
   [Expand]Token Edit Control
   [Expand]Breadcrumb Edit Control
   [Expand]Range Control
   [Expand]Image Slider
    Camera Control
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Expand]Data Grid
  [Expand]Vertical Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Chart Control
  [Expand]Diagrams
  [Expand]Gauges
  [Expand]Map Control
  [Expand]Scheduler
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]Printing-Exporting
  [Expand]PDF Viewer
   Reporting
  [Expand]Snap
  [Expand]TreeMap Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Style Controller

Centralized management over the appearance and paint styles of DevExpress controls can be provided by the StyleController component. This topic describes this component and provides an example on using it.

Expanded Style Controller

The StyleController component allows you to implement centralized control over the look and feel and appearance settings of a group of controls. To bind a control to a style controller, you need to assign the style controller to the control's BaseControl.StyleController property. After this has been done, the control will use the settings provided by the style controller. Changes made to the style controller's properties are immediately reflected by all the bound controls.

Style controllers provide the following settings:

Property Description
StyleController.Appearance Provides common appearance settings for bound controls.

Each control also provides an Appearance property. If a specific appearance attribute of this property is set, it will override the corresponding attribute of the style controller's Appearance property.

StyleController.AppearanceDisabled Provides common appearance settings for bound controls when they are disabled. These settings are in effect only for the controls that provide the AppearanceDisabled property (these are the editors derived from the BaseEdit class).

If a specific appearance attribute (for instance, BackColor) in the AppearanceDisabled property is not set the value for this attribute when the control is disabled will be obtained from the StyleController.Appearance object.

StyleController.AppearanceDropDown Provides common appearance settings for the dropdown windows of bound controls. These settings are in effect only for popup editors derived from the PopupBaseEdit class. These editors also provide an AppearanceDropDown property.
StyleController.AppearanceDropDownHeader Provides common appearance settings for the headers of bound controls' dropdown windows. These settings are in effect only for LookUpEdit and DateEdit editors. These editors also provide the AppearanceDropDownHeader property.
StyleController.AppearanceFocused Provides common appearance settings for bound controls when they are focused.

If a specific appearance attribute (for instance, BackColor) in the AppearanceFocused property is not set the value for this attribute when the control is focused will be obtained from the StyleController.Appearance object.

StyleController.BorderStyle Specifies the border style of bound controls. This property always overrides the BorderStyle property of bound controls.
StyleController.ButtonsStyle Specifies the style of the editor buttons in bound editors. This property always overrides the ButtonsStyle property of bound editors.
StyleController.LookAndFeel Specifies the look and feel of bound controls. This property always overrides the LookAndFeel property of bound controls.
StyleController.PopupBorderStyle Specifies the style of the popup windows in bound editors. This property always overrides the PopupBorderStyle property of bound editors.

Expanded Overriding the Style Controller's Appearance Settings

Each control which is bound to a style controller can override specific appearance settings exposed by the style controller (the look and feel settings of the style controller cannot be overridden by bound controls).

The mechanism for overriding the appearance settings is as follows. If a specific attribute of a control's appearance object is set (for instance, the BackColor property) it will override the corresponding attribute of the style controller's appearance property.

Expanded Example

Assume that a style controller should provide common appearance and look and feel settings for a text editor, button editor and listbox control. The style controller is customized as follows:

Next, the style controller should be assigned to the controls. In the following image it is assigned to a text editor:

Now, if you run the application the controls will look like those displayed in the image below:

Suppose the text color in the text editor should be different than the common color exposed by the style controller. To do this you only need to set the text editor's Appearance.ForeColor property to the required value:

The final result of the customization is shown below. Note that the background color of a text editor is not affected by the modification of the editor's Appearance.ForeColor property. The background color is still retrieved from the style controller.

For detailed information on the Appearance mechanism refer to the Appearances document.

The following code is equivalent to the design-time customization actions illustrated above:

Expanded See Also

How would you rate this topic?​​​​​​​