silverlightexpression-blend-3

Change the source of Image using StoryBoard


I want to change the source of an image using storyboard in silverlight blend on mouse over:

   <VisualState x:Name="MouseOver">
<Storyboard>
   ---code here--                                           
</Storyboard>
</VisualState>

Solution

  • Ok finally solved it :

    On mouse hover i just turn out the visbility of an image to colapsed and made the visibility of other image to visible. That's it :)

                                    <VisualState x:Name="MouseOver">
                                        <Storyboard>
                                            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="fillColor">
                                                <SplineDoubleKeyFrame KeyTime="0" Value=".35"/>
                                            </DoubleAnimationUsingKeyFrames>
                                            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="image">
                                        <DiscreteObjectKeyFrame KeyTime="0">
                                        <DiscreteObjectKeyFrame.Value>
                                        <Visibility>Collapsed</Visibility>
                                        </DiscreteObjectKeyFrame.Value>
                                        </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
    
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="hoverimage">
                                        <DiscreteObjectKeyFrame KeyTime="0">
                                        <DiscreteObjectKeyFrame.Value>
                                        <Visibility>Visible</Visibility>
                                        </DiscreteObjectKeyFrame.Value>
                                        </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>                
                                        </Storyboard>
                                    </VisualState>