c# - display dynamic keys and values from json into xaml -


below json

{"hello":[{"companyname":"one","eta":"10","invoice":{"tf1":" 49","bf1":" 49","md1":"2 km","fpk1":" 12","att":"1 mins"},"tf3":"49"},{"companyname":"one","eta":"10","invoice":{"tf1":" 49","bf1":" 49","md1":"2 km","fpk1":" 15","att":"1 mins"},"tf3":"49"}],"childpresent":true} 

i deserialising , main problem invoice object ( "invoice":{"tf1":" 49","bf1":" 49","md1":"2 km","fpk1":" 15","att":"1 mins"},"tf3":"49"}] ) contains bunch of keys , values...the problem keys inside "invoice" object changes after every 6 hours...and need display both keys , values in xaml

right deserialising above json modal , storing invoice object data dictionary

rootobject j = jsonconvert.deserializeobject<rootobject>(json);  public class hello  {      public dictionary<string, string> invoice { get; set; }     public string companyname {get;set;}     public string eta {get;set;} }  public class rootobject {      public list<hello> hello { get; set; }     public bool childpresent { get; set; } } 

when write in xaml {binding invoice[tf1]} value of tf1 want key tf1 displayed in xaml.

my xaml code

<page x:class="app13.mainpage"       xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"       xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"       xmlns:local="using:app13"       xmlns:d="http://schemas.microsoft.com/expression/blend/2008"       xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"       mc:ignorable="d"       xmlns:converter="using:app13"       background="{themeresource applicationpagebackgroundthemebrush}">   <grid  margin="0,30.333,0,-0.333" background="black">     <listview isitemclickenabled="true" isenabled="true"               itemclick="listview1_itemclick"               scrollviewer.verticalscrollmode="enabled"               scrollviewer.verticalscrollbarvisibility="visible"               x:name="listview1" itemssource="{binding hello}"               fontsize="17" margin="10,0,-10,0">       <listview.items>         </stackpanel>       </listview.items>       <listview.itemtemplate>         <datatemplate>           <grid>             <border tapped="border_tap" height="90">               <stackpanel x:name="parentstackpanel"                           width="380" margin="0,5,0,5">                 <stackpanel background="black"                             margin="60,-80,0,0"                              grid.row="0"                              grid.column="1"                              verticalalignment="center"                             horizontalalignment="left">                   <textblock text="{binding companyname}"                               fontsize="20"                               fontstyle="normal">                   </textblock>                   <textblock text="{binding eta}"                               fontsize="16"                               fontstyle="normal">                   </textblock>                 </stackpanel>                 <stackpanel margin="0,-80,0,0"                              background="black"                              grid.column="0"                              grid.row="0"                              verticalalignment="center"                             horizontalalignment="left">                   <image width="48"                            height="48"                            source="{binding icon}" />                 </stackpanel>                 <stackpanel name="expand"                              background="white"                              height="220">                   <stackpanel orientation="horizontal"                                margin="10,10,0,0">                     <textblock allowdrop="true"                                 grid.column="1"                                 margin="50,0,0,0"                                 horizontalalignment="left"                                 fontsize="10"                                 foreground="black"                                 text="{binding invoice[tf1].key}">                     </textblock>                     <textblock name="tb"                                 grid.column="2"                                 horizontalalignment="right"                                 allowdrop="true"                                 fontsize="6"                                 foreground="black"                                 width="204"                                 text="{binding path=invoice[tf1]}">                     </textblock>                   </stackpanel>                 </stackpanel>                 <stackpanel margin="0,5,0,5"                              height="5"                               grid.row="1"                              background="aqua"                              x:name="something">                 </stackpanel>               </stackpanel>             </border>           </grid>         </datatemplate>       </listview.itemtemplate>     </listview>   </grid> </page> 


Comments

Popular posts from this blog

How to connect android app to App engine -

gcc - MinGW's ld cannot perform PE operations on non PE output file -

php - display validation error message next to the textbox in codeigniter -