Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
417 views
in Technique[技术] by (71.8m points)

windows phone 7 - Display GIF in a WP7 application with Silverlight

I would like to display gif in my WP7 application. Is there some way to achieve this ?

I've tryed this one http://imagetools.codeplex.com/ but can't make it working with WP7.

Thanks in advance for any help

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

In fact, it's working, but it lacks some documentation.

After some troubles, here's how to use it :

  • reference ImageTools
  • reference ImageTools.Controls
  • reference ImageTools.IO.Gif

Add namespace in xaml :

xmlns:imagetools="clr-namespace:ImageTools.Controls;assembly=ImageTools.Controls" 

And resources :

<phone:PhoneApplicationPage.Resources>
    <imagetools:ImageConverter x:Key="ImageConverter" />
</phone:PhoneApplicationPage.Resources>

Then use the control with the converter :

<imagetools:AnimatedImage Source="{Binding ImageSource, Converter={StaticResource ImageConverter}}" />

Your ImageSource should be an Uri, for example :

ImageSource = new Uri("http://mysite/my.gif", UriKind.Absolute);

Don't forget to add decoded :

ImageTools.IO.Decoders.AddDecoder<GifDecoder>();

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

56.8k users

...