Data binding json objects to xaml c# -


i have web api implements crud methods , client windows 8 app. i'm trying bind web api response: json objects (players) xaml , want have name of these players, tried stuff name of object (common.models.player).

protected override async void onnavigatedto(navigationeventargs e)     {         var server = "http://localhost:1504/api";         var service = system.io.path.combine(server, "players");         var players = await getasync<ienumerable<common.models.player>>(new uri(service));         isplayers.itemssource = players;     }      public async system.threading.tasks.task<t> getasync<t>(uri uri)     {         using (var http = new windows.web.http.httpclient())         {             http.defaultrequestheaders.add("accept", "application/json");             var response = await http.getasync(uri);             if (response.statuscode != windows.web.http.httpstatuscode.ok)             {                 throw new exception(response.statuscode.tostring());             }             string json = await response.content.readasstringasync();             return newtonsoft.json.jsonconvert.deserializeobject<t>(json);         }      } 

here's xaml:

 <listbox name="isplayers" itemssource="{binding players}" grid.column="1" grid.row="1" background="{themeresource applicationpagebackgroundthemebrush}">         <datatemplate>             <stackpanel orientation="vertical">                 <textblock text="{binding nameplayer}" fontsize="20"></textblock>             </stackpanel>         </datatemplate>     </listbox> 

i'm new manipulating json, !


Comments

Popular posts from this blog

java - Spring Data JPA: Why findOne(id) executing delete query internally? -

python - Mongodb How to add addtional information when aggregating? -

java - Incorrect order of records in M-M relationship in hibernate -