Answer the question
In order to leave comments, you need to log in
Animation stops in XAML, what could be wrong?
Good afternoon.
There is a TabControl with multiple tabs and there are animations in the tabs.
When switching between tabs, the animation slows down, and then stops altogether.
What can be wrong?
If you do not switch between tabs, then everything is fine.
<Image.Triggers>
<EventTrigger RoutedEvent="Image.Loaded">
<EventTrigger.Actions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)"
RepeatBehavior="Forever" DecelerationRatio="0"
AutoReverse="False" FrameworkElement.FlowDirection="RightToLeft">
<EasingDoubleKeyFrame KeyTime="0:0:2.10" Value="0"></EasingDoubleKeyFrame>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
</Image.Triggers>
<Image.RenderTransform>
<TransformGroup>
<ScaleTransform/>
<SkewTransform/>
<RotateTransform Angle="{Binding Speed, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
<TranslateTransform/>
</TransformGroup>
</Image.RenderTransform>
Answer the question
In order to leave comments, you need to log in
<UserControl.Resources>
<Storyboard x:Key="keyfanStoryboard">
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)"
RepeatBehavior="Forever" DecelerationRatio="0"
AutoReverse="False">
<EasingDoubleKeyFrame KeyTime="0:0:3.10" Value="360"></EasingDoubleKeyFrame>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</UserControl.Resources>
private Storyboard board = null;
---
InitializeComponent();
board = (Storyboard)this.FindResource("keyfanStoryboard");
board.Begin(Animation);
---
board.Resume();
---
board.Pause();
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question