Reordering triggers breaks something

The following works fine:
<Window x:Class="AvalonApplication5.Window1"
xmlns="http://schemas.microsoft.com/winfx/avalon/2005"
xmlns:x="http://schemas.microsoft.com/winfx/xaml/2005"
Title="AvalonApplication5"
>
<Window.Resources>
<Style TargetType="{x:Type Button}">
<Style.Triggers>
<Trigger Property="Button.IsMouseOver" Value="true">
<Setter Property="Background" Value="Yellow" />
</Trigger>
<EventTrigger RoutedEvent="Button.Click">
<EventTrigger.Actions>
<BeginStoryboard>
<Storyboard>
<ColorAnimation Storyboard.TargetProperty="(Button.Background).(SolidColorBrush.Color)" From="Yellow" To="White" Duration="0:0:1" />
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
</Style.Triggers>
</Style>
</Window.Resources>

<Grid>
<Button Content="Click Me!"/>
</Grid>
</Window>


But if I simply change the order of the triggers:
<Window x:Class="AvalonApplication5.Window1"
xmlns="http://schemas.microsoft.com/winfx/avalon/2005"
xmlns:x="http://schemas.microsoft.com/winfx/xaml/2005"
Title="AvalonApplication5"
>
<Window.Resources>

<Style TargetType="{x:Type Button}">
<Style.Triggers>
<EventTrigger RoutedEvent="Button.Click">
<EventTrigger.Actions>
<BeginStoryboard>
<Storyboard>
<ColorAnimation Storyboard.TargetProperty="(Button.Background).(SolidColorBrush.Color)" From="Yellow" To="White" Duration="0:0:1" />
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
<Trigger Property="Button.IsMouseOver" Value="true">
<Setter Property="Background" Value="Yellow" />
</Trigger>
</Style.Triggers>
</Style>
</Window.Resources>

<Grid>
<Button Content="Click Me!"/>
</Grid>
</Window>

Then I get a runtime error "Invalid value 'Yellow' for property 'Background'". So I tried creating a resource for the SolidColorBrush:
<Window x:Class="AvalonApplication5.Window1"
xmlns="http://schemas.microsoft.com/winfx/avalon/2005"
xmlns:x="http://schemas.microsoft.com/winfx/xaml/2005"
Title="AvalonApplication5"
>
<Window.Resources>
<SolidColorBrush x:Key="yellowBrush" Color="Yellow" />

<Style TargetType="{x:Type Button}">
<Style.Triggers>
<EventTrigger RoutedEvent="Button.Click">
<EventTrigger.Actions>
<BeginStoryboard>
<Storyboard>
<ColorAnimation Storyboard.TargetProperty="(Button.Background).(SolidColorBrush.Color)" From="Yellow" To="White" Duration="0:0:1" />
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
<Trigger Property="Button.IsMouseOver" Value="true">
<Setter Property="Background" Value="{StaticResource yellowBrush}" />
</Trigger>
</Style.Triggers>
</Style>
</Window.Resources>

<Grid>
<Button Content="Click Me!"/>
</Grid>
</Window>

And now I get "Invalid value 'true' for property 'IsMouseOver'". Is this a bug or am I missing something?

[3738 byte] By [jedediah] at [2008-2-14]
# 1

Looks like a bug to me. I'd file it over on LadyBug if I were you.

DrewMarsh at 2007-9-9 > top of Msdn Tech,Visual Studio Orcas,Windows Presentation Foundation (WPF)...
# 2
Looks like a generalization of the bug mentioned on p.192 of Sells & Griffiths, "Programming WPF". There, it was an event trigger with a multi-condition property trigger, but apparently ANY property trigger is whacked if it follows an event trigger.

P.S. Fails on my machine also.
I also tried commenting out the "Storyboard" stuff inside - no improvement, it is definitely the event trigger itself.

ToolmakerSteve at 2007-9-9 > top of Msdn Tech,Visual Studio Orcas,Windows Presentation Foundation (WPF)...
# 3
Ok, thanks, guess I won't bother reporting it then.
So this can be worked around by putting event triggers last? I'm still waiting for my copy of that book.
jedediah at 2007-9-9 > top of Msdn Tech,Visual Studio Orcas,Windows Presentation Foundation (WPF)...

Visual Studio Orcas

Site Classified