Article relates to ButtonChrome for WPF Q3 2010
Created by Panayot Cankov, Konstantina Gocheva
Last modified December, 06, 2010
Last modified by Konstantina Gocheva
What is ButtonChrome?
ButtonChrome is a Control that has no input functionality. It provides a wide range of output though. The Idea is to recreate the WPF PresentationFramework.Aero/Luna/Classic/Royale’s ButtonChrome. Silverlight classes lower than Control such as Decorator (like Border) are sealed so we had to make it Control. Also as a pure presentation helper and far from Rad control the ButtonChrome is not included in the telerik uri namespace. It can be found in:
With all these set to their default values the Chrome renders as the background of a Button:
Here are some of the commonly used states of a ButtonChrome:
Styling and Templating
The visual states are achieved with Triggers in WPF.
Drag a ButtonChrome from the toolbox onto the design surface:
Right-click the ButtonChrome and select “Edit Template” > “Edit a Copy” and the control template will be generated for you. You can see the ControlTemplate and the Triggers that change the visual appearance of the ButtonChrome based on the Render properties:
In a Button control the ButtonChrome will have its RenderMouseOver template bound to IsMouseOver, RenderPressed to IsPressed etc. In a ListBoxItem RenderHighlighted will be template bound to IsMouseOver and RenderSelected to IsSelected.
If you create a Style using “apply to all” in blend Impicit style for ButtonChrome will be created and if you are not using one of the telerik themes but rather stay with the default Office_Black the Style will apply to various controls that use the ButtonChrome. The Telerik Themes are not obligated to use the ButtonChrome so in the lightweight Expression Dark such scenario will not work. However, you can see the Office_Black theme controls styled to use a customized ButtonChrome:
You can see how the controls reflect the changes in the ButtonChrome they use within.
The controls which use the ButtonChrome are the following:
So, when you want to change the colour of some of the states for one of these controls, keep in mind that you actually have to edit the ButtonChrome style.