BaseControl.StyleController Property

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

Namespace: DevExpress.XtraEditors

Assembly: DevExpress.XtraEditors.v20.1.dll

Declaration

[DXCategory("Appearance")]
[DefaultValue(null)]
public virtual IStyleController StyleController { get; set; }
<DXCategory("Appearance")>
<DefaultValue(Nothing)>
Public Overridable Property StyleController As IStyleController

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.

Examples

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;

Implements

DevExpress.XtraEditors.ISupportStyleController.StyleController
See Also