Basic Library for WPF and Silverlight | ComponentOne
In This Topic
    ClearStyle Properties
    In This Topic

    ClearStyle technology is a new, quick and easy approach to providing Silverlight and WPF control styling. ClearStyle allows you to create a custom style for a control without having to deal with the hassle of XAML templates and style resources.

    Currently, to add a theme to all standard WPF controls, you must create a style resource template. In Microsoft Visual Studio, this process can be difficult; this is why Microsoft introduced Expression Blend to make the task a bit easier. Having to jump between two environments can be a bit challenging to developers who are not familiar with Blend or do not have the time to learn it. You could hire a designer, but that can complicate things when your designer and your developers are sharing XAML files.

    That's where ClearStyle comes in. With ClearStyle the styling capabilities are brought to you in Visual Studio in the most intuitive manner possible. In most situations you just want to make simple styling changes to the controls in your application so this process should be simple. For example, if you just want to change the row color of your data grid this should be as simple as setting one property. You shouldn't have to create a full and complicated-looking template just to simply change a few colors.

    Each key piece of the control's style is surfaced as a simple color property. This leads to a unique set of style properties for each control. For example, a Gauge has PointerFill and PointerStroke properties, whereas a DataGrid has SelectedBrush and MouseOverBrush for rows.

    Let's say you have a control on your form that does not support ClearStyle. You can take the XAML resource created by ClearStyle and use it to help mold other controls on your form to match (such as grabbing exact colors). Or let's say you'd like to override part of a style set with ClearStyle (such as your own custom scrollbar). This is also possible because ClearStyle can be extended and you can override the style where desired.

    ClearStyle is intended to be a solution to quick and easy style modification but you're still free to do it the old fashioned way with ComponentOne's controls to get the exact style needed. ClearStyle does not interfere with those less common situations where a full custom design is required.

    ComboBox for WPF and Silverlight supports ClearStyle technology that allows you to easily change control colors without having to change control templates. By just setting a few color properties you can quickly style the entire grid.

    The following table outlines the brush properties of the C1ComboBox control:

    Brush Description
    Background Gets or sets the brush of the control’s background.      
    ButtonBackground Gets or sets the brush of the drop-down button’s background.
    ButtonForeground Gets or sets the brush of the drop-down button’s foreground.
    FocusBrush Gets or sets the brush for the control when it has focus.
    MouseOverBrush Gets or sets the brush for the control when it is moused over.
    PressedBrush Gets or sets the brush for the control when it is pressed.
    SelectedBackground Gets or sets the brush of the background for the selected C1ComboBoxItem.

    The following table outlines the brush properties of the C1ComboBoxItem control:

    Brush Description
    Background Gets or sets the brush of the control’s background.

    You can completely change the appearance of the C1ComboBox and C1ComboBoxItem controls by setting a few properties, such as the C1ComboBox control’s ButtonBackground  property, which sets the background color for the control’s drop-down arrow. For example, if you set the C1ComboBox control’s ButtonBackground  property to "#FFC500FF", each header in the C1ComboBox control would appear similar to the following: