How to: Customize Look And Feel of Specific Control(s)
- 2 minutes to read
DevExpress controls are rendered using the global look-and-feel settings the static Default LookAndFeel object exposes. This allows you to apply the same paint scheme to all forms in your application.
You can use a control’s LookAndFeel property to override the default look-and-feel settings:
- Set the control’s LookAndFeel.UseDefaultLookAndFeel property to false to ignore the default settings.
- Customize the control’s LookAndFeel settings as required.
The following code applies the “Seven Classic” skin to a ButtonEdit control:
// Disable the default look-and-feel settings.
buttonEdit1.Properties.LookAndFeel.UseDefaultLookAndFeel = false;
// Specify the skin.
buttonEdit1.Properties.LookAndFeel.Style = DevExpress.LookAndFeel.LookAndFeelStyle.Skin;
buttonEdit1.Properties.LookAndFeel.SkinName = "Seven Classic";
The result is illustrated below.
Tip
The BaseEdit descendants expose the look-and-feel settings with the RepositoryItem.LookAndFeel property (it is available from Editor.Properties.LookAndFeel for standalone editors). Other controls allow you to access these settings with the Control.LookAndFeel property.
Customize Look-And-Feel for a Group of Controls
See this link for details on how to customize the look-and-feel settings for all controls in a form.
Do one of the following to manage controls’ look-and-feel settings:
- Place the StyleController component onto a form, customize it and assign it to the target controls’ BaseControl.StyleController properties. This approach applies to BaseControl descendants (editors, buttons, navigators, list boxes, etc.). Refer to the StyleController topic for more information.
- Create a new UserLookAndFeel object and assign it to the target controls’ LookAndFeel.ParentLookAndFeel (UserLookAndFeel.ParentLookAndFeel) properties.
The code below shows how to use the StyleController component to customize two editors’ look-and-feel settings.
using DevExpress.XtraEditors;
// Create and customize the Style Controller.
StyleController styleController1 = new StyleController();
// Set the background color.
styleController1.Appearance.BackColor = Color.LightYellow;
// Customize the LookAndFeel settings.
styleController1.LookAndFeel.UseDefaultLookAndFeel = false;
styleController1.LookAndFeel.SkinName = "Office 2016 Colorful";
// Assign the StyleController to editors.
buttonEdit1.StyleController = styleController1;
lookUpEdit1.StyleController = styleController1;