My UI components are taking a while to load, I've tried as much as I can to reduce the loading time (and will probably give a few more things a go in future), but I've also introduced a 'busy' indicator to give the user some feedback.
However, I've found the animation stops when components are being loaded, making it pretty useless. I thought WPF had animation on a separate thread?
Here's what I mean, the loading indicator is behind the 'page' being loaded and unlaoded, so it only shows when one is removed. To demonstrate, I've added one that can be seen all the time to the side:
Is there anything I can do to run the storyboard animation in another thread?
It's part of the style, taken from the Material Design XAML toolkit (I've tried to pull out relevant info:
<Style x:Key="MaterialDesignLinearProgressBar" TargetType="{x:Type ProgressBar}">
...
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ProgressBar}">
...
<Grid x:Name="TemplateRoot" RenderTransformOrigin="0,0.5" Opacity="0" Height="4">
<Grid.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleX="0" ScaleY="0" />
<SkewTransform/>
<RotateTransform/>
<TranslateTransform/>
</TransformGroup>
</Grid.RenderTransform>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
...
<VisualState x:Name="Indeterminate">
<Storyboard RepeatBehavior="Forever">
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)" Storyboard.TargetName="Animation">
<EasingDoubleKeyFrame KeyTime="0" Value="0.25"/>
<EasingDoubleKeyFrame KeyTime="0:0:1" Value="0.25"/>
<EasingDoubleKeyFrame KeyTime="0:0:2" Value="0.25"/>
</DoubleAnimationUsingKeyFrames>
<PointAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransformOrigin)" Storyboard.TargetName="Animation">
<EasingPointKeyFrame KeyTime="0" Value="-0.5,0.5"/>
<EasingPointKeyFrame KeyTime="0:0:1" Value="0.5,0.5"/>
<EasingPointKeyFrame KeyTime="0:0:2" Value="1.5,0.5"/>
</PointAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
...
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="transitions:TransitionAssist.DisableTransitions" Value="True">
<Trigger.EnterActions>
<BeginStoryboard Storyboard="{StaticResource OnLoadedNoAnimation}" Name="BeginStoryboardOnLoadedNoAnimation" />
</Trigger.EnterActions>
<Trigger.ExitActions>
<RemoveStoryboard BeginStoryboardName="BeginStoryboardOnLoadedNoAnimation" />
</Trigger.ExitActions>
</Trigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsVisible" Value="True" />
<Condition Property="transitions:TransitionAssist.DisableTransitions" Value="False" />
...
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>