开发者

read in image from SharePoint 2007 custom list & display @ Silverlight 2.0 control,

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(',')开发者_C百科);
        }


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

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜