我看过这篇文章:在Silverlight的WP7应用程序中显示GIF
但就我而言?动画我正在使用弹出窗口.因此,当应用程序启动时,它会显示一个弹出窗口5秒钟.在这个弹出窗口中,我想显示一些.gif图像,但它不起作用.
这是我实现的代码:
public partial class AnimatedSplashScreen : UserControl
{
protected Uri ImageSource
{
get;
set;
}
public AnimatedSplashScreen()
{
InitializeComponent();
ImageSource =
new Uri(
"http://upload.wikimedia.org/wikipedia/commons/thumb/3/36/Sunflower_as_GIF.gif/200px-Sunflower_as_GIF.gif",
UriKind.Absolute);
ImageTools.IO.Decoders.AddDecoder<GifDecoder>();
}
Run Code Online (Sandbox Code Playgroud)
而xaml代码是:
<UserControl.Resources>
<imagetools:ImageConverter x:Key="ImageConverter" />
</UserControl.Resources>
<Grid x:Name="LayoutRoot"
Width="480"
Height="800"
Background="White">
<imagetools:AnimatedImage Source="{Binding ImageSource, Converter={StaticResource ImageConverter}}" />
Run Code Online (Sandbox Code Playgroud)
但结果它不起作用,它显示一个空的背景.
更新:ImageTools.IO.Decoders.AddDecoder(); ImageSource = new Uri(" http://a3.twimg.com/profile_images/1136683647/hisoka_normal.gif ",UriKind.Absolute); 它仍然无法正常工作
c# silverlight silverlight-3.0 silverlight-4.0 windows-phone-7