Using MVVM and Caliburn.Micro I was able to create a BindableCollection<Details> I was able to manually add something to this and put it into a DataGrid, by simply naming the DataGrid after the BindableCollection, code looked like this:
Now I have a Json that I load up, and I want to show the requests I get back, the code I have for the json is fine, just deserialised into a Json class...I couldn't get it to load into the datagrid, so in testing I wrote this:
In XAML I have:
Which worked fine when I had the BindableCollection in the non-async method - and works fine if I make this methohd non-async (though I can't do the whole call to the API) but doesn't appear to work while in an async method?
I am a bit lost as to how to get this to work? If I make the method non-async, it binds fine, in async...nope nothing. I am totally bypassing the json, the collection has numerous results in it, it just isn't binding to the datagrid as it was in a non-async method.
Any insight gratefully received.
C#:
public BindableCollection<Details> Request { get; set; }
public UnusedViewModel()
{
Request = new BindableCollection<Details>();
Request.Add(new Details { ID = "Test"});
}
public class Details
{
public string ID { get; set; }
}
Now I have a Json that I load up, and I want to show the requests I get back, the code I have for the json is fine, just deserialised into a Json class...I couldn't get it to load into the datagrid, so in testing I wrote this:
C#:
Request = new BindableCollection<Detiails>();
foreach (var item in token.requests)
{
Request.Add(new Details { ID = "test" })
}
}
In XAML I have:
C#:
<DataGrid x:Name="Request"/>
Which worked fine when I had the BindableCollection in the non-async method - and works fine if I make this methohd non-async (though I can't do the whole call to the API) but doesn't appear to work while in an async method?
I am a bit lost as to how to get this to work? If I make the method non-async, it binds fine, in async...nope nothing. I am totally bypassing the json, the collection has numerous results in it, it just isn't binding to the datagrid as it was in a non-async method.
Any insight gratefully received.