Hi,I am quite new to Expression Blend and using the VisualStateManager. In the Styles.xaml file, the is a resource I am using which I would like to mofify. The resource is called "ToolbarButton", and it makes use of another resource called "WhiteBackGlowButton". What I would like to do, is to add a "Pressed" state so that after the button is pressed, it as a different appearance, say maybe a different background color. Here is the code from the xaml:
<ControlTemplate x:Key="WhiteBackGlowButton" TargetType="Button">
<Grid Cursor="Hand" Background="Transparent" Margin="0,0,0,0" RenderTransformOrigin="0.5,0.5">
<Grid.RenderTransform>
<ScaleTransform x:Name="handScale" />
</Grid.RenderTransform>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal">
<Storyboard>
<DoubleAnimation To="0" FillBehavior="HoldEnd"
Storyboard.TargetName="brushLight"
Storyboard.TargetProperty="Opacity"
Duration="0:0:0.4" />
<DoubleAnimation To="1" Storyboard.TargetName="handScale" BeginTime="0:0:0" Storyboard.TargetProperty="ScaleX" Duration="0:0:0.1" />
<DoubleAnimation To="1" Storyboard.TargetName="handScale" BeginTime="0:0:0" Storyboard.TargetProperty="ScaleY" Duration="0:0:0.1" />
</Storyboard>
</VisualState>
<VisualState x:Name="MouseOver">
<Storyboard>
<DoubleAnimation To="0.75" FillBehavior="HoldEnd"
Storyboard.TargetName="brushLight"
Storyboard.TargetProperty="Opacity"
Duration="0:0:0.1" />
<DoubleAnimation To="1.15" Storyboard.TargetName="handScale" BeginTime="0:0:0" Storyboard.TargetProperty="ScaleX" Duration="0:0:0.1" />
<DoubleAnimation To="1.15" Storyboard.TargetName="handScale" BeginTime="0:0:0" Storyboard.TargetProperty="ScaleY" Duration="0:0:0.1" />
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<!-- The background white glow effect -->
<Canvas Width="65" Height="55" Margin="-10,-10,0,0" VerticalAlignment="Top" HorizontalAlignment="Left">
<Rectangle x:Name="backGlow" RenderTransformOrigin="0.5,1" IsHitTestVisible="False"
Width="65" Height="55" Canvas.Left="0" Canvas.Top="0">
<Rectangle.Fill>
<RadialGradientBrush x:Name="brushLight" Center="0.5, 0.5" RadiusY="0.5">
<GradientStop Offset="0" Color="#FFFFFFFF" />
<GradientStop Offset="0.98" Color="#00FFFFFF" />
</RadialGradientBrush>
</Rectangle.Fill>
</Rectangle>
</Canvas>
<!-- Content of the menu/tool -->
<ContentPresenter
x:Name="contentPresenter"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
Margin="{TemplateBinding Padding}"/>
</Grid>
</ControlTemplate>
<Style x:Key="ToolbarButton" TargetType="Button">
<Setter Property="Template" Value="{StaticResource WhiteBackGlowButton}" />
<Setter Property="Margin" Value="5" />
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Width" Value="35" />
<Setter Property="Height" Value="30" />
</Style>
I have tried several things and nothing I tried seemed to work for me.Thanks,Paul