Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8853037
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T13:33:03+00:00 2026-06-14T13:33:03+00:00

I am trying to load some data in a separate thread, then add the

  • 0

I am trying to load some data in a separate thread, then add the loaded data to an ObservableCollection and update the view through ba binding.

First, I was doing the following:

public OverviewViewModel()
{
    Thread thread = new Thread(new ThreadStart(delegate
    {
        TheTVDB theTvdb = new TheTVDB();
        foreach (TVSeries tvSeries in theTvdb.SearchSeries("Dexter"))
        {
            this.Overview.Add(tvSeries);
        }
    }));
    thread.SetApartmentState(ApartmentState.STA);
    thread.Start();
}

This gave the following error:

This type of CollectionView does not support changes to its
SourceCollection from a thread different from the Dispatcher thread.

So I read on this forum that I should use the Dispatcher, so I put this.Overview.Add(tvSeries) into a call to the Dispatcher.

Dispatcher.CurrentDispatcher.BeginInvoke((Action)delegate
{
    this.Overview.Add(tvSeries);
},
DispatcherPriority.Normal);

Now, it doesn’t crash anymore but the view is not updated. Nothing happens, the view is just empty. I have tested the functionality by running it on the main thread. Then the view is updated correctly.

Does anyone know why the view is not updated and how I can fix this?

UPDATE

The below approach seems to work and it seems to do everything asynchronously. Can anyone confirm that this is the right approach for doing things asyncronously?

Dispatcher.CurrentDispatcher.BeginInvoke(new Action(delegate
{
    TheTVDB theTvdb = new TheTVDB();
    foreach (TVSeries tvSeries in theTvdb.SearchSeries("Dexter"))
    {
        this.Overview.Add(tvSeries);
    }
}),
DispatcherPriority.Background);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T13:33:04+00:00Added an answer on June 14, 2026 at 1:33 pm

    This is because you will need to tell WPF Dispatcher to handle the threading activity.

    Check this article for more of the core details, and this one for some additional examples.

    The reading can be a bit heavy, but if you’re working with WPF, it’s well worth learning about how the Dispatcher works.

    EDIT: The second article actually explicitly mentions your problem.

    Lastly, don’t forget that ObservableCollection will only fire INPC events for add / remove actions, and not individual element changes. For that you’ll need to implement INPC on the underlying items themselves.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to search through a Load Balancer config and extract some data.
I am trying to load some XML data into C++ code (classes) using gsoap.
I am trying to load an image and add some text to it. my
I'm trying to load page and then remove some elements in it. While doing
I am trying to load some data (which may be up to a few
I'm trying to use the OleDb CSV parser to load some data from a
Im pulling some data from an xml on a separate site and trying to
I'm trying to load some data using sql loader. Here is the top of
I'm trying to load some data from a plist file. It contains an NSArray
I am trying to load some JSON data into to a table using the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.