Thursday, 15 November 2012

Changing Colours in the VisualStateManager

<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal" />
<VisualState x:Name="MouseOver">
<Storyboard>
<ObjectAnimationUsingKeyFrames Duration="0:0:0" Storyboard.TargetName="Border" Storyboard.TargetProperty="Background">
<DiscreteObjectKeyFrame KeyTime="0:0:0" Value="#FF1F6BAD" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Disabled" />
</VisualStateGroup>

Because I always forget, here’s one way for changing colour in the VisualStateManager.  In this example the name of the UI element happens to be “Border”.

No comments:

Post a Comment