Working with simple styles
- What are simple styles?
- Creating a simple style control
- Modifying simple styles
- Applying a style resource to an existing control on the artboard
Microsoft® Expression Blend enables you to go above and beyond simply working with default or system controls as you design the user interface (UI) for your application. Instead, you can actually customize and style controls to your liking to make them perform the way you want andthrough the use of resources in Expression Blendgive them a unique, attractive look to differentiate your application from others as a way to create a highly branded experience or to create a consistent UI across all of your applications.
What are simple styles?
Simple styles are a set of custom, ready-to-use style resources for a set of common system controls, such as the Button and ListBox controls. Expression Blend provides these simple style resources because modifying the style of a system control requires some knowledge of Windows Presentation Foundation (WPF) styles and templates in order to not break the functionality of the control. You can use the simple styles in Expression Blend as a self-contained set of resources that you can quickly modify to create a unique look for your application, without having to start with an understanding of WPF styles and templates.
Creating a simple style control
Simple styles are available in the Asset Library, on the Controls tab, by clicking Simple Styles. Select the Show All check box to see all of the available simple styles. After you select a simple style from the Asset Library, the icon for the simple style appears above the Asset Library button and is selected, ready to be drawn on the artboard. When you draw a simple style (such as the SimpleButton) onto the artboard, you actually create an instance of the system control (such as the Button), but with the SimpleButton style applied to it.
If you want the simple styles to be applied to the tools that are available in the drop-down lists for some of the tools in the Toolbox, you can click the Use as Default button in the Asset Library when Simple Styles is selected on the Controls tab.
The Asset Library showing the available simple style controls, and the option to make them the default styles.
The following table lists the available simple styles and the controls to which they apply.
Simple style | Control to which it applies |
---|---|
SimpleButton | Button |
SimpleCheckBox | CheckBox |
SimpleComboBox | ComboBox |
SimpleComboBoxItem | ComboBoxItem |
SimpleExpander | Expander |
SimpleLabel | Label |
SimpleListBox | ListBox |
SimpleListBoxItem | ListBoxItem |
SimpleMenu | Menu |
SimpleMenuItem | MenuItem |
SimpleProgressBar | ProgressBar |
SimpleRadioButton | RadioButton |
SimpleRepeatButton | RepeatButton in a ListBox control |
SimpleScrollBar | ScrollBar |
SimpleScrollBarRepeatButtonStyle | RepeatButton in a ScrollBar control |
SimpleScrollViewer | ScrollViewer |
SimpleSeparator | Separator in a ListBox, Menu, or ToolBar control |
SimpleSlider | Slider |
SimpleSliderThumb | Thumb in a Slider control |
SimpleTabControl | TabControl |
SimpleTabItem | TabItem in a TabControl |
SimpleTextBox | TextBox |
SimpleThumbStyle | Thumb in a ScrollBar in a ListBox control |
SimpleTreeView | TreeView |
SimpleTreeViewItem | TreeViewItem in a TreeView control |
SimpleTreeViewItemToggleButton | ToggleButton in a TreeView control |
Modifying simple styles
The simple style resources are contained in a resource dictionary named SimpleStyles.xaml. After you add a simple style to the artboard from the Toolbox, the SimpleStyles.xaml resource dictionary is added to your project, and all of the simple style resources are visible in the Resources panel.
The SimpleStyles.xaml resource dictionary includes brush resources and other templates that are used by the simple styles. You can make any of the following changes to the simple styles:
- Change the colors The colors that are used by
all of the simple styles are stored as resources that you can change.
To change one of the color resources, click the down arrow button next to the color resource in the Resources panel. For information about brushes, see Essentials of appearance.Choosing to edit a brush resource in the Resources panel.
- Change the style You can use the style of a control in
Expression Blend to
specify properties and triggers that will be used as defaults by the control to
which the style is applied. The properties (such as the background brush color)
will affect the control's appearance, and the triggers will affect how the
control responds to property changes and events. For example, the SimpleButton
style includes a trigger for the IsMouseOver property such that the button's appearance is
changed when the user moves their mouse pointer over the control. The trigger
occurs when the IsMouseOver property changes from False to True.
To change one of the simple styles, click the Edit Resource button next to the simple style in the Resources panel.Choosing to edit a style resource in the Resources panel.
- Change the control template The template of a
control defines its appearance by defining the child controls that are contained
within the control. For example, the control template for the SimpleTextBox
element
contains a Grid element, which in turn contains a Border element, which contains
a ScrollViewer element named PART_ContentHost. The ScrollViewer element
displays the content of the TextBox when the SimpleTextBox style is applied to a
TextBox on the artboard. Just like the style, you can set property and event triggers in the
control template.
To change the control template for a simple style, click the Edit resource button next to the simple style in the Resources panel, right-click the Style element that appears under Objects and Timeline, point to Edit Control Parts (Template), and then click Edit Template.Choosing to edit the control template when starting from the editing scope of the style.
Control templates are wrapped inside styles so that the style that is applied to a control includes both the appearance (parts) and the behavior for the control. This is important to remember when choosing between Edit a Copy and Edit Template.
For a detailed comparison between styles and templates, see Styles and templates. For specific information about simple styles and examples of modifying the simple styles and control templates, see the topics listed under Reference and Try it! in Simple styles.
Applying a style resource to an existing control on the artboard
The simple styles are resources that can be applied and managed like any other resource. For an example, see Apply a style resource in this User Guide. For more information about resources, see Resource overview in this User Guide.