#142 – Dependency Property Value Sources: #8 – Theme Style Triggers
December 1, 2010 2 Comments
The eighth source in the list of sources for the base value of a dependency property is a theme style trigger. A theme style trigger is a trigger defined in the default style for a control. Every control that ships with WPF has a default style that dictates its appearance, also known as a theme style.
As an example, notice that when you set the IsEditable property of a ComboBox to true, it’s appearance changes.
The change in appearance is caused by a trigger in the default style. If you right-click on a ComboBox in Blend and pick Edit a Template | Edit a Copy, you can see the default style for a ComboBox, including the following trigger on IsEditable.
<Trigger Property="IsEditable" Value="true">
<Setter Property="BorderBrush" Value="{StaticResource TextBoxBorder}"/>
<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"/>
<Setter Property="IsTabStop" Value="false"/>
<Setter Property="Padding" Value="3"/>
<Setter Property="Template" Value="{StaticResource ComboBoxEditableTemplate}"/>
</Trigger>

