Monday, August 27, 2012

How to change the border thickness in mouseover

How to change the border thickness in mouseover

I'm working on the styles of controls. I want to change the borderthickness of a control when the mouseover is done. I want to write this in the style itself instead of writing it in codebehind

So, I tried in the following way.

<VisualState x:Name="MouseOver"> <Storyboard> <DoubleAnimationUsingKeyFrames Storyboard.TargetName="Border" Storyboard.TargetProperty="BorderThickness"> <SplineDoubleKeyFrame  KeyTime="0" Value="2" />                                    </DoubleAnimationUsingKeyFrames> </Storyboard> </VisualState> 

But this is throwing an error.

How can I achieve this functionality.

Answers & Comments...

Answer: 1

Use ObjectAnimationUsingKeyFrames instead DoubleAnimationUsingKeyFrames in your case:

<ObjectAnimationUsingKeyFrames Storyboard.TargetName="Border" Storyboard.TargetProperty="BorderThickness">     <DiscreteObjectKeyFrame KeyTime="0" Value="2"/> </ObjectAnimationUsingKeyFrames> 

DoubleAnimationUsingKeyFrames animates the value of a Double property, whereas BorderThickness is type of Thickness, not Double.

by : Zabavskyhttp://stackoverflow.com/users/1199711




No comments:

Post a Comment

Send us your comment related to the topic mentioned on the blog