1 <UserControl x:Class="MoonTest.System.Windows.XamlStyle"
2 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4 xmlns:vsm="clr-namespace:System.Windows;assembly=System.Windows">
5 <UserControl.Resources>
6 <Style x:Key="ButtonStyle" TargetType="Button">
7 <Setter Property="Template">
9 <ControlTemplate TargetType="Button">
11 <vsm:VisualStateManager.VisualStateGroups>
12 <vsm:VisualStateGroup>
13 <vsm:VisualState x:Name="Normal">
15 <ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="target" Storyboard.TargetProperty="(Rectangle.Fill).(SolidColorBrush.Color)">
16 <SplineColorKeyFrame KeyTime="00:00:00" Value="Black"/>
17 </ColorAnimationUsingKeyFrames>
20 </vsm:VisualStateGroup>
21 </vsm:VisualStateManager.VisualStateGroups>
22 <ContentPresenter ContentTemplate="{TemplateBinding ContentTemplate}">
23 <Rectangle x:Name="target" Height="50" Width="100" Fill="Green"/>
30 </UserControl.Resources>
31 <Grid x:Name="LayoutRoot" Background="White">
32 <Button Style="{StaticResource ButtonStyle}" />
33 <TextBlock Text="The rectangle fill should be black, not green" />