Problem with animated GIF in WPF
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, sa开发者_JS百科ved 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?
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.
精彩评论