Reputation: 8003
I've got this problem:
I read from web a json result from a query and after I wish load it into a DataGrid
object.
Here is my code:
void readData()
{
var client = new HttpClient();
HttpResponseMessage Response = await client.GetAsync("http://goo.gl/3LbKQy");
int statusCode = (int)Response.StatusCode;
string results = await Response.Content.ReadAsStringAsync();
dynamic data = JsonConvert.DeserializeObject(results);
myDataGrid.ItemsSource = data;
}
but my grid contains the rows empty.. my guess is that the dynamic data doesn't allow to obtain the fields info on datagrid.
Upvotes: 0
Views: 1035
Reputation: 10764
The ItemsSource value needs to implement IEnumerable and the DataGrid will probably struggle to auto-generate columns as reflection does not work well with dynamic types.
Upvotes: 2