Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9031197
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T07:40:15+00:00 2026-06-16T07:40:15+00:00

To show animated GIF in WPF/C# I use this code sample in Microsoft MSDN

  • 0

To show animated GIF in WPF/C# I use this code sample in Microsoft MSDN : Show GIF animation in WPF.

When I use this in modeless window (window.Show()), the image do not animate. Why?

With window.ShowDialog() (modal window) it works correctly.

In WPF Project Befor Start MainWindow i show a window to do my first task in modeless and then close it.(these are in app.xaml.cs Startup event)

// app.xaml.cs 
public partial class App : Application
{
    private void Application_Startup(object sender, StartupEventArgs e)
    {
        FirstTask firstTask = new FirstTask();
        firstTask.Show();

        // do task
        System.Threading.Thread.Sleep(5000);

        firstTask.Close();

        MainWindow mainWindow = new MainWindow();

        mainWindow.ShowDialog();
    }
}

I add below code end of AnimatedGIFControl_Loaded function in AnimatedGIFControl class to start animate gif automatically.

ImageAnimator.Animate(_bitmap, OnFrameChanged);

complete AnimatedGIFControl_Loaded code

     void AnimatedGIFControl_Loaded(object sender, RoutedEventArgs e)
    {
        // Get GIF image from Resources
        if (gifanimate.Properties.Resources.ProgressIndicator != null)
        {
            _bitmap = gifanimate.Properties.Resources.ProgressIndicator;
            Width = _bitmap.Width;
            Height = _bitmap.Height;

            _bitmapSource = GetBitmapSource();
            Source = _bitmapSource;
            ImageAnimator.Animate(_bitmap, OnFrameChanged);
        }             
    }

ImageAnimator.Animate(_bitmap, OnFrameChanged);

Also i add to firstTask window and MainWindow to show animated gif.

Another problem: after firstTask.Close(); application do not show MainWindow. did you know why?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T07:40:16+00:00Added an answer on June 16, 2026 at 7:40 am

    Show() method does not block the call and continues with the execution,

    ShowDialog() method blocks the call and waits with the execution until the modal dialog is closed (and also during that,all UI messages are dispatched)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've created a custom layout to show gif animated image. Here is the code:
With this code I can show an animated gif while the server script is
How would I modify this code to show the animated movement (item moving from
Can we show a animated gif image in android by using VideoView ? If
i have a custom view to show a gif animated image. The problem born
I added an animated gif image in an imageView. I am not able to
I want to show animated gif images for product . Uploading gif image is
I'm using jquery to show animated MSN like window at the bottom of the
The code like this: $(.hide).click(function(){ $(.online-contact).animate({width: 'toggle',height: '100%'}, fast); $(this).hide(); $(.show-class).show(); }) I want
This .show and .hide works great in Firefox 3 but not in IE 7.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.