Images aren't displayed in listbox after binding

zbrown

New Member
I am having an issue where in a listbox binding text is being displayed but none of the binding images are. I download and parse an xml file just fine and display the text I want but then want to show an image depending on the status. \[code\]Linename\[/code\] and \[code\]Service\[/code\] show OK but the binding image does not show at all. Atype is just used to call the GetImage method (not neat I know). It should then set the ImageSource according to the status but no image is shown at all. \[code\] XElement XmlTweet = XElement.Parse(e.Result); var ns = XmlTweet.GetDefaultNamespace(); listBox1.ItemsSource = from tweet in XmlTweet.Descendants(ns + "LineStatus") select new FlickrData { Linename = tweet.Element(ns + "Line").Attribute("Name").Value, Service = tweet.Element(ns + "Status").Attribute("Description").Value, Atype = GetImage(tweet.Element(ns + "Status").Attribute("Description").Value) }; public String GetImage(String type) { FlickrData f = new FlickrData(); switch(type) { case "Good Service": f.Type = new BitmapImage(new Uri("/Images/status_good.png", UriKind.Relative)); break; case "Minor Delays": f.Type = new BitmapImage(new Uri("/Images/status_minor.png", UriKind.Relative)); break; case "Severe Delays": f.Type = new BitmapImage(new Uri("/Images/status_severe.png", UriKind.Relative)); break; case "Planned Closure": f.Type = new BitmapImage(new Uri("/Images/status_minor.png", UriKind.Relative)); break; } return "anything"; } \[/code\]In FlickrData it is a simple get set with the imagesource \[code\]Type\[/code\] not displaying.\[code\] public class FlickrData { public string Linename { get; set; } public string Service { get; set; } public string Detail { get; set; } public ImageSource Type { get; set; } public string Atype { get; set; } }\[/code\]
 
Back
Top