I am trying to make a TranslateTransform animation. In the animation, I need my object to remain at the center of the window. I know WPF animation is Freezable. I am using a converter, but it initializes values at startup. Is there any way to set the value of EasingDoubleKeyFrame at runtime?
Here is my XAML code:
<Storyboard x:Key="Storyboard1">
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)" Storyboard.TargetName="grid">
<EasingDoubleKeyFrame KeyTime="0" Value="{Binding Width, Converter={StaticResource Minus}, ElementName=grid}"/>
<EasingDoubleKeyFrame KeyTime="0:0:1" Value="{Binding Width, Converter={StaticResource EnteringValueConverter}, ElementName=grid}"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>