views:

496

answers:

0

I'm having an issue when triggering a storyboard from the code behind. I've just changed the storyboard to use a dependency property, which works, but only after the calling FindResource() twice. I build the dependency property using a UIPropertyMetadata object to set the initial value which appears to work. Does anyone know what I'm doing wrong?

Storyboard story;
story = ((Storyboard)FindResource("Grow"));
story = ((Storyboard)FindResource("Grow"));
story.Begin(this)


<UserControl.Resources>
<Storyboard x:key="Grow">
   <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="ButtonPanel" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)">
       <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0.1"/>
       <SplineDoubleKeyFrame KeyTime="00:00:00.2000000" Value="{Binding PanelScaling}"/>
   </DoubleAnimationUsingKeyFrames>
   <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="ButtonPanel" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)">
       <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0.1"/>
       <SplineDoubleKeyFrame KeyTime="00:00:00.2000000" Value="{Binding PanelScaling}"/>        
   </DoubleAnimationUsingKeyFrames>
</Storyboard>
</UserControl.Resources>