从 SharePoint 2007 自定义列表和显示 @ Silverlight 2.0 控件中读入图像,



如何读取图像&当我的输出如下时,在我的Silverlight 2.0控件上显示它们?(我目前使用的是lists.asmx)

20;#http://moss:48420/Image Picker图片列表/1 e166fc4 a07a - 4680 a52a - c04f75394cc9.jpg; # http://moss: 48420/图像% 20选择% 20幅% 20列表/_t/1 e166fc4 - a07a - 4680 - a52a c04f75394cc9_jpg.jpg

我的Silverlight应用程序类似于:http://weblogs.asp.net/scottgu/pages/silverlight-tutorial-part-5-using-the-listbox-and-databinding-to-display-list-data.aspx

片段:

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(','));
        }

事实证明,我必须编辑方法'FormatImageUrl2'中的行:

返回value.Substring (value.LastIndexOf (", ") + 2),

相关内容

  • 没有找到相关文章