Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 923
Tim Avatar asked Nov 11 '10 08:11

Tim


1 Answers

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>();
like image 190
Tim Avatar answered Oct 11 '22 16:10

Tim