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

查看:23
本文介绍了使用 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);

不要忘记添加解码:

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

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

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