0

How may I read in images & display them on my Silverlight 2.0 control when my output is the following? (i'm currently using lists.asmx)

20;#http://moss:48420/Image Picker Picture List/1e166fc4-a07a-4680-a52a-c04f75394cc9.jpg;#http://moss:48420/Image%20Picker%20Picture%20List/_t/1e166fc4-a07a-4680-a52a-c04f75394cc9_jpg.jpg

My Silverlight application is similar to: http://weblogs.asp.net/scottgu/pages/silverlight-tutorial-part-5-using-the-listbox-and-databinding-to-display-list-data.aspx

Snippet:

private void ProcessResponse2()
        {
            XDocument results = XDocument.Parse(_responseString);

            _StaffNews = (from item in results.Descendants(XName.Get("row", "#RowsetSchema"))

                          //where !item.Element("NewsThumbnail").Attribute("src").Value.EndsWith(".gif")
                          select new StaffNews()
                          {
                              Title = item.Attribute("ows_Title").Value,
                              NewsBody = item.Attribute("ows_NewsBody").Value,
                              Thumbnail = FormatImageUrl2(item.Attribute("ows_NewsThumbnail").Value),
                              DatePublished = item.Attribute("ows_Date_Published").Value,
                              PublishedBy = item.Attribute("ows_PublishedBy").Value,
                          }).ToList();

            this.NewsList.DataContext = _StaffNews;              
        }

private string FormatImageUrl2(string value)
        {
            return value.Substring(0, value.IndexOf(','));
        }

1 Answer 1

0

Turns out that i have to edit the lines within method 'FormatImageUrl2':

return value.Substring(value.LastIndexOf(";#") + 2);

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.