I'm using BackgroundWorker
private BackgroundWorker BGWorker = new BackgroundWorker();
BGWorker.DoWork += BGWorker_DoWork;
BGWorker.RunWorkerAsync();
private void BGWorker_DoWork(object sender, DoWorkEventArgs e)
{
ObterInformacoes();
}
private void BGWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{
dgv.ItemsSource = ObterInformacoes();
}
private List<Informacoes> ObterInformacoes()
{
List<Informacoes> func = gestores.gInfo.Recuperar(new Filtro[] {
new Filtro(eInfo.Ativa, true),
new Filtro(eInfo.Recorrente, false)
}).Select(f => new Informacoes(f)).ToList();
return func.OrderBy(f => f.Nome).AsParallel().ToList();
}
And this error is returning me:
Additional information: You must create DependencySource in the same Thread that DependencyObject.
Does anyone know what it can be?