【发布时间】: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