简体   繁体   中英

How To Add ImageTools GIF To Grid in Windows Phone 8 Silverlight

I am making a program that will use the Windows Phone 8 Silverlight

I want to Show GIF Image with ImageTools on Grid but I can't add ExtendedImage grid's children.

Decoders.AddDecoder<GifDecoder>();
ExtendedImage eAt = new ExtendedImage();
eAt.UriSource = new Uri("medias/at.gif", UriKind.Relative);
grd.Children.Add(eAt);

Error : Argument 1: cannot convert from 'ImageTools.ExtendedImage' to 'System.Windows.UIElement'

I'll be glad if you fix it, thank you :)

Have you tried to use Image like this:

Decoders.AddDecoder<GifDecoder>();
ExtendedImage eAt = new ExtendedImage();
eAt.UriSource = new Uri(@"/medias/at.gif", UriKind.RelativeOrAbsolute);
eAt.LoadingCompleted += new EventHandler((ss, ee) =>
{
    Dispatcher.BeginInvoke(() =>
    {
        Image img = new Image();
        img.Source = eAt.ToBitmap();
        grd.Children.Add(img);
    });
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM