JSON Data Binding Window Store App Using C# -


i'm trying fetch items text file, in json format (data.txt):

[   {     "name": "store",     "items": [       {         "lev": "1",         "brand": "imported"       }     ]   } ] 

now want show these items in separate listview, name used heading on top. please guide me.

in viewmodel create properties:

private string _name; public string name {     { return _name; }     set     {         if (_name != value)         {             _name = value;             propertychanged?.invoke(this, new propertychangedeventargs(nameof(name)));         }     } }  private ienumerable<jsonobject> _items; public ienumerable<jsonobject> items {     { return _items; }     set     {         if (_items != value)         {             _items = value;             propertychanged?.invoke(this, new propertychangedeventargs(nameof(items)));         }     } } 

and method

void parsejson(string json) {     var obj = jsonarray.parse(json)[0].getobject();     name = obj.getnamedstring("name");     items = obj.getnamedarray("items"); } 

in view create listview:

<listview itemssource="{binding items}" header="{binding name}" /> 

Comments

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -