views:

233

answers:

1

This is an example of a ComboBox's ControlTemplate.

CLICK HERE

I've tried to set the Background / add a trigger to change the background when the ComboBox is focused (with a tab key for example), both without success. I don't even understand why it isn't included by default ! (compared to the original generic template)

A: 

Do you mean change the background of the ComboBoxItem when it is focused? Its not normal to change the background of an entire ComboBox. Keep in mind that the template is different for editable ComboBoxes.

From looking at the template you referenced, the Background property is used for the ComboBox dropdown. So you're trigger needs to target that outter most Grid. Did you try adding triggers like these?

<Trigger Property="IsKeyboardFocusWithin" Value="True">
    <Setter TargetName="[outtermostgrid]" Property="Background" Value="Red" />
</Trigger>
<Trigger Property="IsDropdownOpen" Value="True">
    <Setter TargetName="[outtermostgrid]" Property="Background" Value="Red" />
</Trigger>
Steven
Well I added the trigger to the Border of the ToggleButton ControlTemplate which works.. Which Grid do you mean ? The first Grid in the visual tree in the ComboBox ControlTemplate?
PaN1C_Showt1Me