views:

85

answers:

1

Hello

I try to show animated GIFs in WPF application using custom classes found at http://stackoverflow.com/questions/210922/how-do-i-get-an-animated-gif-to-work-in-wpf First I used AnimatedImage class, after that - GifImage class. Both classes failed during animation initialization (while resoving Uri to the GIF file, saved as app. resource, its "Build action" = resource).

The result of second attempts was shown in the picture at this link: http://i.piccy.info/i5/47/02/490247/2.png

Sorry for link, but StackOverflow engine says, that I must have at least 10 reputation points in order to use pictures.

What is the error?

A: 

The path to the image isn't specified correctly.

When using resource files packed into the assembly all you need to provide is the path to the image, without /component or anything else. You can try both with and without a leading slash, I forget what the difference is.

If you want to specify the absolute URI, you'll need the entire PackURI:

pack://application:,,,/MyProgram;component/Subfolder/ResourceFile.ext

You can find more details about the pack URIs in the quite comprehensive MSDN page dedicated to them.

Alex Paven
Thank you, Alex, packed uri is working
JSP