Styling ComboBox when DropDown opens and closes in WPF
i am wondering if it's possible to create styles in XAML to the events of a Control. To prope开发者_运维问答rties i know that is possible, but and to the Events?
What i need is to apply some styles to a ComboBox when the DropDown opens, and then apply other style after DropDown closes. Is possible to create a style in XAML to this event or any other one?
This is easy to do when he create the event in the code behind and it will do whatever we want, but i am wondering if it's possible to prevent that and simply create a Style.
And anyway it's a Style that i will apply in more than one ComboBox, and so it's why i don't want to create one event per ComboBox.
Do you really need the events? How about this:
<Style TargetType="{x:Type ComboBox}">
<!-- Default style setters here -->
<Style.Triggers>
<Trigger Property="IsDropDownOpen" Value="True">
<!-- Opened style setters here -->
</Trigger>
</Style.Triggers>
</Style>
精彩评论