'Trigger a Storyboard Animation without control event from 'Code Behind'? (VB.Net only please)

There's a little section in my code where I have a little bit of text briefly flashing. It's a 'TextBlock', it will contain some text, then it will be updated for a second time, then eventually, the third time I'll make it flash (opacity 0 to 1, 1 to 0) - currently using a timer. I'd like to get away from using a timer and switch to using a WPF 'Storyboard - DoubleAnimation' setup, it's nice and smooth and works great. However, I'm not really sure how to control it from 'Code Behind'.

So, for example, take this code:

  <TextBlock Name="MyAnimationTest"
               Grid.Row="0"
               Grid.Column="1"
               FontWeight="Bold"
               FontSize="20"
               Foreground="Yellow"
               HorizontalAlignment="Center">
        A Test TextBlock
        <TextBlock.Triggers>
            <EventTrigger RoutedEvent="MouseEnter">
                <BeginStoryboard>
                    <Storyboard>
                        <DoubleAnimation
                            Storyboard.TargetName="MyAnimationTest"
                            Storyboard.TargetProperty="Opacity"
                            From="0" To="1" 
                            Duration="0:0:1" 
                            AutoReverse="True" 
                            RepeatBehavior="Forever" />
                    </Storyboard>
                </BeginStoryboard>
            </EventTrigger>
        </TextBlock.Triggers>
    </TextBlock>

This works great. However, in this example the trigger is 'MouseEnter'. I want to be able to Start|Stop this at will from 'Code Behind'.

Thanks for your response.

Oh please, if you do know a solution, please for the love of God, 'vb.net', not 'C#'.

Thanks again.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source