I am using a WCF weather service and receiving weather information like ID, Description, and Images. It returns like this:
<WeatherDescription>
<WeatherID>1</WeatherID>
<Description>Thunder Storms</Description>
<PictureURL>
http://ws.cdyne.com/WeatherWS/Images/thunderstorms.gif
</PictureURL>
</WeatherDescription>
Now in the XAML I am showing my data in a dataGrid as so:
<sdk:DataGridTextColumn Header="ID" Binding="{Binding WeatherID}" />
The above binding is to another function of the service that returns a 7 day forecast but returns the same weather ID that works with the weather description. I created an array of all the Weather Descriptions on the code side like so:
public partial class MainPage : UserControl
{
//array of weather descriptions
private WeatherDescription[] weatherInformation;
WeatherSoapClient weatherClient = new WeatherSoapClient();
public MainPage()
{
InitializeComponent();
weatherClient.GetWeatherInformationCompleted += new EventHandler<GetWeatherInformationCompletedEventArgs>(weatherClient_GetWeatherInformationCompleted);
weatherClient.GetWeatherInformationAsync();
}
void weatherClient_GetWeatherInformationCompleted(object sender, GetWeatherInformationCompletedEventArgs e)
{
weatherInformation = e.Result;
}
}
What I want to do is create a converter that takes the ID from that Column and converts it to an image using the URL supplied in the weather descriptions.
I know Silverlight does not support GIF's so I would like to send that image to a handler that would convert it to a JPG.
Being brand new to both Silverlight and C# these are two things that I am really having trouble with. Thank you for the help in advance! And code snippets are the best help for me since I do not understand a lot of C# yet.