Skip to main content
A newer version of this page is available. .

BaseControl.StyleController Property

Gets or sets the style controller component that provides style settings for this control.

Namespace: DevExpress.XtraEditors

Assembly: DevExpress.XtraEditors.v18.2.dll

Declaration

[DXCategory("Appearance")]
[DefaultValue(null)]
public virtual IStyleController StyleController { get; set; }

Property Value

Type Default Description
DevExpress.XtraEditors.IStyleController *null*

An object that implements the DevExpress.XtraEditors.IStyleController interface which provides style settings for the current control.

Remarks

Style controllers enable you to provide a common appearance for the controls in your application. Place a StyleController component onto the form, customize its properties as needed, and assign it to the StyleController property of the desired controls. The settings provided by the assigned style controller override the style settings specified by controls. So, all controls will then use the same style settings. When changing style controller settings, all the bound controls are automatically updated, providing centralized control over the controls’ style settings.

When a style controller is assigned, the control’s style properties return the corresponding properties of the bound style controller. Similarly, changing the control’s style properties affects the settings of the bound style controller and the styles of all the controls whose StyleController properties refer to the same style controller.

When a control is used within a LayoutControl, setting the StyleController property to a StyleController object is in effect only if the LayoutControl’s OptionsView.ShareLookAndFeelWithChildren property is set to false. Otherwise, this control’s style settings are determined by the LayoutControl.

Example

The following example creates a style controller and assigns it to a text and button editor. By doing so, the appearance of both editors is controlled by the StyleController object.

In the code we change the background color, font settings and style for editor buttons using corresponding properties of the style controller. The image below shows the result of the customization:

StyleController_example

using DevExpress.XtraEditors;
using DevExpress.XtraEditors.Controls;

StyleController sc = new StyleController();
sc.Appearance.Font = new Font("Tahoma", 11, FontStyle.Bold);
sc.Appearance.BackColor = Color.LemonChiffon;
sc.ButtonsStyle = BorderStyles.UltraFlat;
textEdit1.StyleController = sc;
buttonEdit1.StyleController = sc;

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the StyleController property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also