I am creating several custom controls in a wrapper panel. I have a view model associated with usercontrol, and I have an animation called by a property in the view model. Very easy to switch colors from red to transparent to simulate blinking.
<Storyboard x:Key="alertAnimation" RepeatBehavior="Forever" AutoReverse="True" > <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)" Storyboard.TargetName="TileBorder" BeginTime="00:00:00" RepeatBehavior="Forever" AutoReverse="True" > <DiscreteColorKeyFrame Value="Red"/> <DiscreteColorKeyFrame KeyTime="00:00:00.500" Value="Transparent" /> </ColorAnimationUsingKeyFrames> </Storyboard>
This works great. However, since I load multiple user elements asynchronously, the blinking animations do not sync, so they all blink at different times. Now there is a requirement that all blinking on the screen should all blink at the same speed / time. Is there a way to sync these animations? It seems I cannot find an example that is suitable for what I am trying to execute. Is there a way to use ParallelTimeline, add all animations to it and start / stop them from one controller? Any examples how to do this?
EDIT 4/20 Would it be better to have the animation defined in the style.xaml file and have a βglobalβ storyboard in which each control adds its own βblinkingβ animation and the main user interface launches the storyboard?
source share