2

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?

Community
  • 1
  • 1
JSP
  • 457
  • 1
  • 7
  • 19
  • archive with the exmaple VS2010 project: http://rapidshare.com/files/419195171/WpfApplication2.rar – JSP Sep 15 '10 at 13:42

1 Answers1

0

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
  • 5,539
  • 2
  • 21
  • 35