I have to resort to the viewmodel firing an event, and on catching that event, refreshing the whole grid. What is the point of something observable when it's not observed?
This is how may main form starts up, first populating the grid, and repopulating it every time something is added to the collection:
private void MainForm_Load(object sender, EventArgs e)
{
FoundFilesBindingSource.DataSource = ViewModel;
// TODO Try get rid of event model.
ViewModel.FilesFound += (o, args) =>
{
if (FileInfosGrid.InvokeRequired)
{
FileInfosGrid.Invoke(new Action(() => FileInfosGrid.DataSource = ViewModel.FileInfos));
}
else
{
FileInfosGrid.DataSource = ViewModel.FileInfos;
}
};
}
On class ViewModel
, FileInfos
is declared as:
public ObservableCollection<FindMatchViewModel> FileInfos { get; set; }