使用Silverlight在WP7应用程序中显示GIF [英] Display GIF in a WP7 application with Silverlight

查看:98
本文介绍了使用Silverlight在WP7应用程序中显示GIF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在WP7应用程序中显示gif. 有什么办法可以做到这一点?

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

我已经尝试过这个 http://imagetools.codeplex.com/,但是无法使其与WP7一起使用.

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

在此先感谢您的帮助

推荐答案

实际上, 它正在工作,但是缺少一些文档.

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

遇到一些麻烦后,这里是使用方法:

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

  • 参考ImageTools
  • 参考ImageTools.Controls
  • 参考ImageTools.IO.Gif

在xaml中添加名称空间:

Add namespace in xaml :

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

和资源:

<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}}" />

您的ImageSource应该是Uri,例如:

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>();

这篇关于使用Silverlight在WP7应用程序中显示GIF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆