【问题标题】:read in image from SharePoint 2007 custom list & display @ Silverlight 2.0 control,从 SharePoint 2007 自定义列表中读取图像并显示@ Silverlight 2.0 控件,
【发布时间】:2011-08-04 03:18:01
【问题描述】:

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

20;#http://moss:48420/Image Picker 图片 List/1e166fc4-a07a-4680-a52a-c04f75394cc9.jpg;#http://moss:48420/Image%20Picker%20Picture%20List/_t/1e166fc4-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(','));
        }

【问题讨论】:

    标签: c# asmx silverlight-2.0


    【解决方案1】:

    原来我必须编辑方法“FormatImageUrl2”中的行:

    返回值.Substring(value.LastIndexOf(";#") + 2);

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2010-10-07
      • 1970-01-01
      • 2011-05-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多