2
votes

I try to show animated GIFs in WPF application using custom classes found at 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?

1
archive with the exmaple VS2010 project: rapidshare.com/files/419195171/WpfApplication2.rar - JSP

1 Answers

0
votes

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.