5 comments on “Image UserControl with FadeIn & FadeOut Animation for WinRT

  1. Pingback: Image UserControl with FadeIn & FadeOut Animation for WinRT

  2. Pingback: Image UserControl with FadeIn & FadeOut Animation for WinRT | Answer My Query

  3. Pingback: Windows Store Developer Links – 2013-05-29 | Dan Rigby

  4. Excellent sample! I made something similar in my project when I wanted to animate image changes.
    There is just one problem in your sample that I should warn you about, considering that you are using the same storyboard every time and that LoadImage method could be called more than once. Using lambda to add a handler for storyboard completed event will create and add a new one every time LoadImage is executed. This is OK if you are using temporary storyboards to play animation only once before disposing of it but it is not the case here.
    A good way around that would be to define event handler first so you can reference to itself in order to unsubscribe from completed event when it completes.

    The body of LoadImage method should look like this:

    EventHandler handler = null;
    handler = delegate
    {
        ImageFadeOut.Completed -= handler;
        Image.Source = source;
        ImageFadeIn.Begin();
    };
    ImageFadeOut.Completed += handler;
    ImageFadeOut.Begin();
    

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s