I have a list that I use as a log. I want to see the log in a listview therefor I have created:
<ListView Margin="12,114,12,12" Name="listView1" ItemsSource="{Binding}" IsSynchronizedWithCurrentItem="True" />
The log gets populated with a field on a class that I did not create, so there is a class as:
SomeClass
{
public ReadOnlyCollection<Status> Log
{
get
{
return _log.AsReadOnly();
}
}
// other method and fields
// etc...
}
so I am able to see the list items. Moreover, I am able to populate the listview with this log as:
listView1.DataContext = server.Log; // server is an instance of SomeClass
the only problem is that every time the log changes the listview does not update. I have to call listView1.DataContext = server.Log; every time I wish to refresh the log.
how can I avoid having to refresh the listview?