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

Setting URI kind to relative disables animation of gifs

Zircon99 opened this issue · comments

hi Thomas,

I have tried several ways to get the animation working using relative URI, but unable to do so. I implement a delegate method registered to Animationloaded, sender receiver is then null and unable to Play().

Setting autostart = true also does not work when relative URI is used. When I switch to absolute URI everything works - the delegate method sender != null so play() works fine and autostart also works.

Can you kindly assist?

Hi,

I don't really understand what you're trying to do and what you've done so far... Could you show some code?

I think what he said is:
When you use UriKind.Relative to get the gif animation, the animation only act like a static image. The animation can't play. Like this:
BitmapImage _faceMaskGif = new BitmapImage();
_faceMaskGif.BeginInit();
_faceMaskGif.UriSource = new Uri("/Assets/14.gif", UriKind.Relative);
_faceMaskGif.EndInit();
But when you use pack URI to get the gif animation, the animation can play well.
BitmapImage _faceMaskGif = new BitmapImage();
_faceMaskGif.BeginInit();
_faceMaskGif.UriSource = new Uri("pack://application:,,,/Assets/14.gif");
_faceMaskGif.EndInit();
Actually, I also met this issue, and I didn't find the solution. I still use pack URI.

hi there

So sorry, I did not get back - I have been travelling.

Indeed, correct. I also use absolute URI now, use a work around to resolve
the relative URI and all is well.

Thank you!

Rolf

On Mon, Nov 7, 2016 at 10:42 AM, Bearsuny notifications@github.com wrote:

I think what he said is:
When you use relative URI to get the gif animation, the animation only act
like a static image. The animation can't play. Like this:
BitmapImage _faceMaskGif = new BitmapImage();
_faceMaskGif.BeginInit();
_faceMaskGif.UriSource = new Uri("/Assets/14.gif", UriKind.Relative);
_faceMaskGif.EndInit();
But when you use absolute URI to get the gif animation, the animation can
play well.
BitmapImage _faceMaskGif = new BitmapImage();
_faceMaskGif.BeginInit();
_faceMaskGif.UriSource = new Uri("pack://application:,,,/Assets/14.gif");
_faceMaskGif.EndInit();
Actually, I aslo met this issue, and I didn't find the solution to solve.
I still use absolute URI. :(


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#25 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AV6hFq4H19UpVqFP9pzT8vEoOfpd8fKWks5q7uSLgaJpZM4KdD--
.

Yes, you have to specify an absolute URI if you set the image from code-behind.

Relative URIs are supported in XAML, because the XAML stack has a mechanism to resolve the absolute URI (see the IUriContext interface).

Great thank you, but all sorted. The library has been useful, thank you for
assisting.

Rolf

On Mon, Nov 7, 2016 at 2:48 PM, Thomas Levesque notifications@github.com
wrote:

Yes, you have to specify an absolute URI if you set the image from
code-behind.

Relative URIs are supported in XAML, because the XAML stack has a
mechanism to resolve the absolute URI (see the IUriContext interface
https://msdn.microsoft.com/en-us/library/system.windows.markup.iuricontext.aspx
).


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#25 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AV6hFjwntQh6uUSfPa5CfPIh1Zzg3c3Kks5q7x4bgaJpZM4KdD--
.