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

  • SEARCH
  • Home
  • 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 6340017
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T19:45:31+00:00 2026-05-24T19:45:31+00:00

Update2 I’ve rewritten the entire question, because some things became a lot clearer, the

  • 0

Update2

I’ve rewritten the entire question, because some things became a lot clearer, the issue now seems to be that I created a list of DependencyProperties on a different thread than where the DependencyProperties will be used :(.

When I do some work on a BackgroundWorker the XAML bindings cause an ArgumentException

Must create DependencySource on same Thread as the DependencyObject.

I’ve got the following setup:

I’ve got a simple class that implements INotifyPropertyChanged which contains a few ints, list’s and Dictionaries.

public class Calculator : INotifyPropertyChanged
{
    //Note that InstanceGroup is a dependency object
    private List<InstanceGroup> instanceGroups = new List<InstanceGroup>();
    public List<InstanceGroup> InstanceGroups
    {
        get { return instanceGroups; }
        set { instanceGroups = value; }
    }

    // snip //

    public void Calculate()
    {
        InstanceGroups = MyNewFilledInstanceGroup;
            if (PropertyChanged != null)
            {
              PropertyChanged(this, new PropertyChangedEventArgs("instanceGroups"));
            }
    }
}

In a UserControl I use a BackgroundWorker to run the Calculate method, because it can take a lot of time:

BackgroundWorker worker = new BackgroundWorker();
worker.DoWork += delegate(object o, DoWorkEventArgs args)
{
    lock (Calculator)
    {       
        Calculator.Calculate();
    }
};
worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(worker_RunWorkerCompleted);
worker.RunWorkerAsync();

In the XAML file of the UserControl I have multiple bindings to the Calculator, like {Binding Path=Calculator.InstanceGroups, Path=userControlName}.

(The overall goal is to be able to do all the work in the Calculate method on a separate thread so I can show a progress bar or something like that)

  • 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-05-24T19:45:32+00:00Added an answer on May 24, 2026 at 7:45 pm

    The only solution seems to be to not create DependencyProperties ( How to handle ObservableCollection<> result from a parallelized Task in MVVM? ) in a background task, this weird behavior costed me the better part of the day. But at least now I know what the problem was.

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

Sidebar

Related Questions

UDATE3: found the issue. See the answer below. UPDATE2: It seems I might have
UPDATE2: I think I got it now: <?php /* * @name Lawler's algorithm PHP
Update2: For now, I'm considering saving a temporary copy of the document in html
UPDATE2 I think I found the true source of the leaks. I had some
How to get a list of files that match some pattern if filenames may
Update2 Please see my answer to my question. Update So, I updated the code
UPDATE2: I got it working completely now! Scroll way down to find out how...
[Update2] So is it OK that when I run git from the CLI it
Update2: What I really wanted to ask was already argued in a different page.
UPDATE: First problem solved, second one described at the bottom of this post. UPDATE2:

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.