Windows Phone 7 Silverlight supports GIF natively?

For the longest time, I was under the impression that there’s no way to natively load GIFs through applications on Windows Phone.. That also seems to be the common perception on the web here, here, here, here and many other places…

However… It looks like loading GIFs is supported natively in the platform – via (of all things) – PictureDecoder.DecodeJpeg

Take the following random GIF Bing image search gave me:

We know it’s a GIF because the signature is that of a gif:


And the following simple proof of concept loads it:

Code Snippet
  1. public MainPage()
  2. {
  3.     InitializeComponent();
  5.     WebClient client = new WebClient();
  6.     client.OpenReadCompleted += new OpenReadCompletedEventHandler(Client_OpenReadCompleted);
  7.     client.OpenReadAsync(new Uri(""));
  9. }
  11. void Client_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e)
  12. {
  13.     image1.Source = PictureDecoder.DecodeJpeg(e.Result);
  14. }

What am I missing here? Is this really working, or is there something else? I tried half a dozen GIFs and they seem to be working fine (both on the phone and in the emulator)

Download sample project


This entry was posted in Dev. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s