Reputation: 4408
I had the following template that essentially changed the color of the border of a button based on its pressed state:
<ControlTemplate x:Name="SkillIconTemplate" TargetType="Button">
<Border CornerRadius="10" BorderThickness="2" Margin="5" Background="{TemplateBinding Background}">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualStateGroup.Transitions>
<VisualTransition To="MouseOver" GeneratedDuration="0:0:0.05"/>
<VisualTransition To="Pressed" GeneratedDuration="0:0:0.05"/>
</VisualStateGroup.Transitions>
<VisualState x:Name="Normal" />
<VisualState x:Name="MouseOver">
<Storyboard>
<ColorAnimation Storyboard.TargetName="BorderBrush"
Storyboard.TargetProperty="Color"
To="Yellow" />
</Storyboard>
</VisualState>
<VisualState x:Name="Pressed">
<Storyboard>
<ColorAnimation Storyboard.TargetName="BorderBrush"
Storyboard.TargetProperty="Color"
To="Black"/>
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Border.BorderBrush>
<SolidColorBrush x:Name="BorderBrush" Color="White"/>
</Border.BorderBrush>
</Border>
</ControlTemplate>
Now, it doesn't seem to work in Win8 RC. In Consumer Preview it did the following:
Normal State: White
Hovered State: Yellow
Pressed State: Black
Now it does:
Normal State: White
Hovered State (Before Pressed): White
Hovered State (After Pressed): Black
Pressed State: Black
Any ideas why?
Upvotes: 0
Views: 1092
Reputation: 691
the set of defined visual states has been changed, use PointerOver instead of MouseOver. The most of changes from Consumer Preview listed in here http://go.microsoft.com/fwlink/?LinkId=251943
Upvotes: 1