Run something after an animation - WPF

0

I have the following animation when I initialize my project:

    public ConfigInicial_Empresa()
    {
        InitializeComponent();

        brush = (Brush)bc.ConvertFrom("#444");
        window.Background = brush;

        DoubleAnimation fadingAnimation = new DoubleAnimation();
        fadingAnimation.BeginTime = TimeSpan.FromMilliseconds(500);
        fadingAnimation.From = 0;
        fadingAnimation.To = 2;
        fadingAnimation.Duration = TimeSpan.FromSeconds(1.75);
        fadingAnimation.AutoReverse = true;

        tbBemVindo.BeginAnimation(TextBlock.OpacityProperty, fadingAnimation);
    }

I would like to do something right after this animation ends ...

How can I be successful at this task?

Thank you in advance ...

    
asked by anonymous 07.01.2016 / 16:29

1 answer

1

Just put a Handler's signature on Completed before calling beginAnimation.

 public ConfigInicial_Empresa()
    {
        InitializeComponent();

        brush = (Brush)bc.ConvertFrom("#444");
        window.Background = brush;

        DoubleAnimation fadingAnimation = new DoubleAnimation();
        fadingAnimation.BeginTime = TimeSpan.FromMilliseconds(500);
        fadingAnimation.From = 0;
        fadingAnimation.To = 2;
        fadingAnimation.Duration = TimeSpan.FromSeconds(1.75);
        fadingAnimation.AutoReverse = true;
        fadingAnimation.Completed += new EventHandler(fadingAnimation_Completed);
        tbBemVindo.BeginAnimation(TextBlock.OpacityProperty, fadingAnimation);
    }

private void fadingAnimation_Completed(object sender, EventArgs e)
{
    //NXZERO > METALLICA
}

Source - > link

    
07.01.2016 / 16:55