Styling the RadRibbonComboBox
The RadRibbonComboBox can be styled by creating an appropriate Style and setting it to the Style property of the control.
You have two options:
- To create an empty style and set it up on your own.
- To copy the default style of the control and modify it.
This topic will show you how to perform the second one.
Modifying the Default Style
In order to copy the default style, load your project in Expression Blend and open the User Control that holds the RadRibbonView. In the 'Objects and Timeline' pane select the RadRibbonComboBox you want to style.
From the menu choose Object -> Edit Style -> Edit a Copy. You will be prompted for the name of the style and where to be placed.
If you choose to define the style in Application, it would be available for the entire application. This allows you to define a style only once and then reuse it where needed.
After clicking 'OK', Expression Blend will generate the default style of the RadRibbonComboBox control in the Resources section of your User Control. The properties available for the style will be loaded in the 'Properties' pane and you will be able to modify their default values.
If you want to change the ControlTemplate elements of the RadRibbonComboBox select the style in the 'Objects and Timeline' pane, right-click on it and choose Edit Template -> Edit Current. In the same pane the element parts for the RadRibbonComboBox's template will get loaded.
The RadRibbonComboBox has two templates - Editable and NonEditable. As default the NonEditable is used. To modify the Editable template you have to right-click on the style and select Edit Additional Templates -> Edit EditalbeTemplate -> Edit Current.
If you go to the 'Resources' pane, you will see an editable list of resources generated together with the style and used by it. In this list you will find the brushes, styles and templates needed to change the visual appearance of the RadRibbonComboBox. Their names indicate to which part of the RadRibbonComboBox's appearance they are assigned.
RibbonComboBoxBackgroundBrush - a brush that represents the background color of the RadRibbonComboBox.
RibbonComboBoxBorderBrush - a brush that represents the color of the RadRibbonComboBox's border.
RibbonComboBoxForegroundBrush - a brush that represents the foreground color of the RadRibbonComboBox's content.
ExpanderButtonNormal_Border- a brush that represents the color of the expander button's border.
ExpanderButtonNormal_Background - a brush that represents the background color of the expander button.
ExpanderButtonPressed_OuterBorder- a brush that represents the color of the expander button's outer border, when it gets pressed.
ExpanderButtonPressed_Background - a brush that represents the background color of the expander button, when it gets pressed.
ExpanderButtonPressed_Border- a brush that represents the color of the expander button's border, when it gets pressed.
RibbonGroupButtonArrow - a brush that represents the color of the expander button's arrow.
ExpanderButtonOver_OuterBorder- a brush that represents the color of the expander button's outer border, when the mouse is over it.
ExpanderButtonOver_Border- a brush that represents the color of the expander button's border, when the mouse is over it.
ExpanderButtonOver_Background - a brush that represents the background color of the expander button, when the mouse is over it.
-
ToggleButtonStyle - represents the style applied to the expander button.
When the RadRibbonComboBox is not editable, the whole control represents the expander button. When it is editable, the button is placed on its right.
RibbonPopupBackgroundBrush - a brush that represents the background color of the popup area.
RibbonPopupOuterBorderBrush - a brush that represents the color of the popup area's outer border.
RibbonPopupInnerBorderBrush - a brush that represents the color of the popup area's inner border.
DisabledBrush - a brush that represents the background color of the RibbonComboBox when it is disabled
NonEditableComboBox - represents the ControlTemplate that is applied to the RadRibbonComboBox, when it is not editable.
RibbonComboBoxHotBackgroundBrush - a brush that represents the background color of the editable area of the RadRibbonComboBox.
RibbonComboBoxHotBorderBrush - a brush that represents the border color of the editable area of the RadRibbonComboBox.
EditableComboBox - represents the ControlTemplate that is applied to the RadRibbonComboBox, when it is editable.
RadRibbonComboBoxStyle - represents the style applied to the RadRibbonComboBox.
Changing the value of the resources can be done by clicking on the color indicator or the icon next to them.
Modify the resource to bring the desired appearance to the RadRibbonComboBox . For more detailed information, please, view the Example section below.
Example
Here is an example of the above resources modified:
Here is a snapshot of the result, when the RadRibbonComboBox is not editable:
and when it is editable: