I have a ListView that is bound to an ObservableCollection in the XAML code like this:
<Page
...
DataContext="{Binding Pages, RelativeSource={RelativeSource Self}}" />
<ListView x:Name="lstWebpages" ItemsSource="{Binding}" >
Now I would like to rebind it in code. Something like this:
lstWebpages.DataSource = Pages;
lstWebpages.DataBind();
But since the Pages collection is somehow bound to the Page and the ListView control, I’m a little bit confused?
The problem initially is that I get an error when I try to sort the Pages list as asked here:
https://stackoverflow.com/questions/13567987/hresult-e-fail-in-winrt-listview-add
I believe all you need to do is assign a different
ItemsSourceor the
DataContext