VoodooFrog
asked on
Problem with Silverlight Animation -- cannot resolve targetname
I created a simple animation via ExpressionBlend to give a confirmation of a user control being clicked. the UserControl that I made is simply called MyRectangle and does not do much right now.
What I thought would be the simplest way to create a click confirmation is to create a new myRectangleObject -- called myRectangleAnimate which starts of with an opacity of 0. When the user clicks on the object I move myRectangleAnimate to the same position as the clicked object, set the opacity to 1.0 and then run the Storyboard that I created in blend.
When I call the Storyboard.Begin() method I get the following error:
"Cannot resolve TargetName myRectangleAnimate"
myRectangleAnimate is defined in the XAML of the MainPage.xaml and starts off with the opacity at 0.
Here is the storyboard:
myRectangle is defined as:
What I thought would be the simplest way to create a click confirmation is to create a new myRectangleObject -- called myRectangleAnimate which starts of with an opacity of 0. When the user clicks on the object I move myRectangleAnimate to the same position as the clicked object, set the opacity to 1.0 and then run the Storyboard that I created in blend.
When I call the Storyboard.Begin() method I get the following error:
"Cannot resolve TargetName myRectangleAnimate"
myRectangleAnimate is defined in the XAML of the MainPage.xaml and starts off with the opacity at 0.
Here is the storyboard:
<Canvas x:Name="myCanvas" Width="731" Height="395">
<Canvas.Resources>
<Storyboard x:Name="storyboardExpandContract" Completed="storyboardExpandContract_Completed">
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleX)" Storyboard.TargetName="myRectangleAnimate">
<EasingDoubleKeyFrame KeyTime="0" Value="1"/>
<EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="2"/>
<EasingDoubleKeyFrame KeyTime="0:0:1" Value="1"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleY)" Storyboard.TargetName="myRectangleAnimate">
<EasingDoubleKeyFrame KeyTime="0" Value="1"/>
<EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="2"/>
<EasingDoubleKeyFrame KeyTime="0:0:1" Value="1"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</Canvas.Resources>
myRectangle is defined as:
<local:myRectangle x:Name="myRectangleAnimate" Canvas.Left="589" Canvas.Top="232" RenderTransformOrigin="0.5,0.5" Opacity="0">
<local:myRectangle.RenderTransform>
<CompositeTransform/>
</local:myRectangle.RenderTransform>
</local:myRectangle>
the code that sets the location and opacity of myRectangle: Canvas.SetLeft(myRectangleAnimate, Canvas.GetLeft(Selected));
Canvas.SetTop(myRectangleAnimate, Canvas.GetTop(Selected));
myRectangleAnimate.Opacity = 1.0;
storyboardExpandContract.Begin();
the error occurs when I call the Begin().
See the accepted solution in the below link may be it will helpful to upto some extent:
http://forums.silverlight.net/forums/p/15490/51226.aspx#51226
http://forums.silverlight.net/forums/p/15490/51226.aspx#51226
ASKER
I don't think that solution is applicable here -- I have tried it in both scopes.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER