c# - How to binding List<image> to xaml? -


how can bind images 300x300 width , height of images[1] xaml?

     public class trackspotify     {         public class externalurls         {             public string spotify { get; set; }         }      public class image     {         public int height { get; set; }         public string url { get; set; }         public int width { get; set; }     }      public class item     {         public string album_type { get; set; }         public list<string> available_markets { get; set; }         public externalurls external_urls { get; set; }         public string href { get; set; }         public string id { get; set; }         public list<image> images { get; set; }         public string name { get; set; }         public string type { get; set; }         public string uri { get; set; }     }      public class albums     {         public string href { get; set; }         public list<item> items { get; set; }         public int limit { get; set; }         public string next { get; set; }         public int offset { get; set; }         public object previous { get; set; }         public int total { get; set; }     }      public class rootobject     {         public albums albums { get; set; }     } } 
 "images" : [ {          "height" : 640,          "url" : "i.scdn.co/image/8642802d13a53541e313781c34521a0d33099aac",          "width" : 640        }, {          "height" : 300,          "url" : "..................",          "width" : 300        }, {          "height" : 64,          "url" : "....................",          "width" : 64        } ], 

                            <grid.rowdefinitions>                                 <rowdefinition height="200"></rowdefinition>                                 <rowdefinition height="140"></rowdefinition>                             </grid.rowdefinitions>                             <stackpanel  grid.row="0">                                 <image source="{binding url}"></image>                             </stackpanel>                             <grid grid.row="1">                                                                         <stackpanel verticalalignment="top" margin="10">                                         <textblock text="{binding name}" foreground="#d4d4d4" fontsize="12"></textblock>                                         <textblock text="{binding album_type}" foreground="#404040" fontsize="15" fontweight="semibold"></textblock>                                      </stackpanel>                               </grid>                         </grid>                     </datatemplate> 
var arrays = jsonconvert.deserializeobject<newreleasespotify.rootobject>(query);             spotifyitems.itemssource = arrays.albums.items; 

i understand not being real because list instead of receiving single image, can create converter bind list of images or class , return image want. try first returning string , if not work (depending on platform) try return new bitmapimage url want.

and can set size in bitmapimage (it makes processing faster) , apart set size in too.


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -