I have an IEnumerable which isgetting values from JSON in pagebehind:
IEnumerable jsonData = default(IEnumerable);
jsonData = GetJsonValues(URL);
Now I have a collection which contains :
Title = “Some Title” and
Thumbnail = “URI as String”
Now I have my XAML Containing ListBox:
<ListBox Width="480" Height="280" x:Name="listBoxJsonData" />
How do I bind jsonData with listBoxJsonData.
I dont want to use listBoxJsonData.ItemsSource = jsonData;
Create a property of it and use MVVM pattern to bind using DataContext.
This way (Not tested) inside a new class say
ViewModel.csand in XAML
and in window constructor