Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7175585
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T16:19:45+00:00 2026-05-28T16:19:45+00:00

I am using a RSS feed to display content in my app. Everything works

  • 0

I am using a RSS feed to display content in my app. Everything works great except gif images. I have read that Silverlight doesn’t support the gif file format so I’ve been trying to use the ImageTools plugin.

There seems to be loads of examples where people click a button and the image displays on the same page but I want to call the image when my listbox is being populated.

Currently this is what I have:

XAML:

xmlns:imagetools="clr-namespace:ImageTools.Controls;assembly=ImageTools.Controls"
....
<ListBox x:Name="Weather">
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <StackPanel>

                            <imagetools:AnimatedImage Source="{Binding WeatherIcon, Converter={StaticResource DisplayGIF}}" />

                            <TextBlock Name="temperatureBlock" Text="{Binding WeatherTemperatureSummary}" TextWrapping="Wrap" Margin="12,0,0,0" FontSize="{Binding HeadlineSize}" Foreground="{Binding WeatherTemperatureSummary, Converter={StaticResource StylesAndColours}}" />
                            <TextBlock Name="summaryBlock" Text="{Binding Summary, Converter={StaticResource RssTextTrimmer}}" TextWrapping="Wrap" Margin="12,-6,0,10" FontSize="{Binding SummarySize}" />
                        </StackPanel>
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>

DisplayGif class:

using ImageTools;
using ImageTools.IO;
using ImageTools.IO.Gif;
using System.Windows.Data;
using System.Text;
using System.IO;
using System.Windows.Media.Imaging;
public class DisplayGIF : IValueConverter
{

    public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
    {
        byte[] buffer = Encoding.Unicode.GetBytes(value.ToString());
        Stream stream = new MemoryStream(buffer);
        ExtendedImage image = new ExtendedImage();
        ImageTools.IO.Decoders.AddDecoder<GifDecoder>();
        return image.ToBitmap(); // give error that image is not loaded
    }

    public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
    {
        throw new NotSupportedException();
    }
}

The above code fails as the image is not yet loaded. Is there a work around to this or even a better/easier way to get the gif images to display?

EDIT 1

Based on Ku6opr’s answer I have altered my class. When I start my app now it hangs as I suspect I am not managing the threads correctly.

public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
    {
        byte[] buffer = Encoding.Unicode.GetBytes(value.ToString());
        Stream stream = new MemoryStream(buffer);
        ExtendedImage image = new ExtendedImage();
        ImageTools.IO.Decoders.AddDecoder<GifDecoder>();
        image.SetSource(stream);
        EventWaitHandle Wait = new AutoResetEvent(false);
        image.LoadingCompleted += (s, e) =>
        {
            Wait.Set();
        };
        Wait.WaitOne();
        return image.ToBitmap();
    }

Edit 2:

Ok, turns out the gif images I was trying to link to were not hot linkable! The link provided by Ku6opr do work – just make sure that you can actually link to the images from an outside source 😉

http://www.java2s.com/Open-Source/ASP.NET/Silverlight/imagetools/ImageTools/Controls/ImageConverter.cs.htm

Thanks,

Rich

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T16:19:46+00:00Added an answer on May 28, 2026 at 4:19 pm

    Probably, it loads image asynchronously. I guess, you need to wait while it completely loaded. ExtendedImage maybe has some event (LoadingCompleted or something else)

    public object Convert(object value, Type targetType, object parameter,         System.Globalization.CultureInfo culture)
    {
        byte[] buffer = Encoding.Unicode.GetBytes(value.ToString());
        Stream stream = new MemoryStream(buffer);
        ImageTools.IO.Decoders.AddDecoder<GifDecoder>();
        ExtendedImage image = new ExtendedImage();
        image.Source = stream;
        EventWaithandle Wait = new AutoResetEvent(false);
        ExtendedImage.LoadingCompleted += (s, e) =>
        {
            Wait.Set();
        };        
        Wait.Wait();
        return image.ToBitmap(); // give error that image is not loaded
    }
    

    While I wrote this code I see that you never assign Stream to your image. Check it

    EDIT:
    ImageTools already has ImageConverter class that works with Streams, Absolute and Revative uri paths. It source code to look inside you can find here: http://www.java2s.com/Open-Source/ASP.NET/Silverlight/imagetools/ImageTools/Controls/ImageConverter.cs.htm

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an RSS feed, users will be using it to rip content to
I've created an RSS feed using Zend_Feed. It seems to have worked in that
I have a blog's RSS feed that I am trying to display on another
I am planing to display Rss feed inside an Androind app I have this
I have an RSS feed that I follow and would like to display it
i have to parse a RSS feed and display the same in android. i
I'm trying to display rss feed using jQuery plugin jFeed as below. It's printing
I am consuming an RSS feed to display on my website using a repeater
I'm using ZrssFeed to display an rss feed. I would like to limit it
I am using an RSS feed to display news on my site. I am

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.