2011-08-04 2 views
0

Comment puis-je lire dans les images & les afficher sur mon contrôle Silverlight 2.0 lorsque ma sortie est la suivante? (J'utilise actuellement Lists.asmx)lire dans l'image à partir de SharePoint 2007 liste personnalisée et l'affichage @ contrôle Silverlight 2.0,

20; #http: // mousse: 48420/Image Picker Image Liste/1e166fc4-a07a-4680-A52A-c04f75394cc9.jpg; #http: // mousse: 48420/image% 20Picker% 20Picture% 20List/_t/1e166fc4-a07a-4680-A52A-c04f75394cc9_jpg.jpg

Mon application Silverlight est similaire à: 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(',')); 
     } 

Répondre

0

Il s'avère que je dois modifier les lignes dans la méthode 'FormatImageUrl2':

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

Questions connexes