Hi there,
I have a ViewModel with the following collection:
public ReactiveCollection<TeamProject> Projects { get; set; }
This collection is loaded using:
var teamProjects = _planService.TeamProjects();
Projects = teamProjects.CreateCollection();
whereas...
public IObservable<TeamProject> TeamProjects()
{
return _teamProjectRepository.GetProjects().ToObservable();
}
and...
public IEnumerable<TeamProject> GetProjects()
{
// iterations with a yield after loading the teamProject in a time-consuming webservice call
yield return teamProject;
}
So basically, I'm converting an IEnumerable<TeamProject> to an IObservable<TeamProject> to a ReactiveCollection<TeamProject>
This loads fine, but it blocks my UI. While searching on the internet why this blocks, I've found that I probably should (please correct me if I'm wrong) add a schedular to the ToObservable() method.
So I changed it to use .ToObservable(Scheduler.Default)
The UI doesn't block anymore, but when the collection receives items, I get a threading exception:
"This type of CollectionView does not support changes to its SourceCollection from a thread different from the Dispatcher thread."
From what I understand, CreateCollection() should synchronize the threads, not?