XamlAnimatedGif / WpfAnimatedGif

A simple library to display animated GIF images in WPF, usable in XAML or in code.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Gif are not animated when the BitmapImage is already downloaded when settting animation source

valhentai opened this issue · comments

Gif are not animated when the BitmapImage is already downloaded when settting animation source

Hi @valhentai,

Could you give more details on how to reproduce the issue?

I was wrong, it is not when image is already loaded. It happen when the BitmapImage is already downloaded.
if I do

ImageModule.BitmapImage.DownloadCompleted += (e, a) =>
 {
       ImageBehavior.SetAnimatedSource(image, ImageModule.BitmapImage);
  };

There will be no animation. When I set the AnimatedSource when BitmapImage.IsDownloading is true, the animation will work.

I don't have this problem with XamlAnimatedGif but the animation is too slow with this library.

I got an AnimationLoaded event but GetAnimationController return null. So I must reach this part of the code

if (source != null)
{
SetIsAnimationLoaded(imageControl, true);
imageControl.RaiseEvent(new RoutedEventArgs(AnimationLoadedEvent, imageControl));
}

My BitmapImage use a stream source and not a Uri so
bool isLoadingDeferred = IsLoadingDeferred(source);

must be false.

OK, so there seems to be multiple problems... Not sure where it's coming from. If you could provide a short but complete example that reproduces the issue, it would be very helpful.

I did some debbuging and in the end the problem didn't came from your library. My BitmapSource reference was changed so when I setted set animation source at different time I ended up setting a different source and one was corrupted.

I'm glad you were able to solve your problem. Thanks for letting me know!