Change Background of Combobox using a Trigger if IsEditable November 5, 2008
Posted by spunkyvt in Programming, WPF.Tags: comboBox, Trigger, WPF
add a comment
After many frustrations of googling and coding I finally found how to change the background of a combobox when triggering on IsFocused and the combobox is editable. When the combo is in edit mode it displays a regular textbox for it’s edit portion. In the Style trigger section use a data trigger and bind to the element PART_EditableTextBox.
<Style.Triggers>
<DataTrigger Binding=”{Binding ElementName=PART_EditableTextBox,Path=IsFocused}” Value=”True”>
<Setter Property=”Background” Value=”Yellow”/>
</DataTrigger>
</Style.Triggers>