- 3 minutes to read
Like other DevExpress WinForms controls the Layout Control supports the Appearances mechanism which gives you the ability to modify the appearance settings (background and foreground colors, font settings, etc) of almost any visual element. Indeed the Layout Control contains properties to customize the appearance of layout items, layout groups, tabbed groups and controls displayed within the layout control (only if these represent specific DevExpress controls. See below).
Appearance of Layout Items and Groups
To change the appearance settings of a specific layout item, group or tabbed group, use the properties that start with the Appearance prefix. For a layout item, use the BaseLayoutItem.AppearanceItemCaption property, which allows you to change the font settings and color of the layout item’s caption.
For a group/tabbed group, the LayoutItemContainer.AppearanceGroup, BaseLayoutItem.AppearanceItemCaption and LayoutItemContainer.AppearanceTabPage properties are available. These properties allow you to change various appearance settings of the current group and its children.
Note that the Layout Control supports the inheritance of the appearance settings of layout items, groups and tabbed groups. The appearance settings that are set for a specific group are applied by default to the group’s children (its layout items, nested groups and layout items that belong to the nested groups). To override these settings for a specific child group or layout item, you need to change the appearance of this group/item explicitly. With this inheritance model, you will generally modify the appearance settings of the root group. All the nested groups and items will use these settings by default. To access the root group, use the LayoutControl.Root property.
In specific painting schemes (Skin, WindowsXP and Office 2003), changing the background colors of the layout items, groups and group captions has no effect. In these modes, the colors are determined by the current painting scheme. To change the painting scheme, use the LayoutControl.LookAndFeel property.
Appearance of Controls within the Layout Control
Specific DevExpress .NET controls (e.g., the editors derived from the BaseControl class such as the TextEdit, ButtonEdit, LookUpEdit and ListBoxControl controls) allow their appearance and look-and-feel settings to be centrally customized via a style controller object. All of these editors implement the DevExpress.XtraEditors.ISupportStyleController interface.
One of the approaches to customize the appearance and look-and-feel settings of such editors in a centralized way is to add a StyleController component to a form, adjust its settings and assign the style controller to each of the target editors. These editors will then have the same appearance and look-and-feel settings that are specified by the style controller. Set the OptionsView.ShareLookAndFeelWithChildren option to false to support this scenario.
Note, however, that typically there is no need to use an external StyleController component to customize the appearance and look-and-feel settings of child controls within the Layout Control, as the Layout Control itself can act as a style controller. If the OptionsView.ShareLookAndFeelWithChildren option is set to true (the default value), the settings of the LayoutControl.Appearance and LayoutControl.LookAndFeel objects are automatically propagated and applied to the Layout Control’s child DevExpress WinForms controls. Notice that all of these controls have the StyleController property set to the current LayoutControl object.
If you only need to change the look-and-feel settings of the Layout Control and its child controls, the best way is to use the DefaultLookAndFeel component. By default, the settings of the DefaultLookAndFeel object are applied to all DevExpress forms (XtraForm descendants) and DevExpress WinForms controls within all DevExpress and standard forms.