Solved

The calling thread cannot access the object becuase a different thread owns it

Posted on 2014-01-24
3
232 Views
Last Modified: 2014-02-07
I have a WPF MVVM application.
I have this particular piece of code which gives the above error.

It is triggered whn a button is clicked and works fine the first time the button is clicked.
But the next time arround on the second button click I get the error.
PivotGrid is an UI element in my view, and I am accessing the UI element in my Viw Model

 Application.Current.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(
                  delegate()
                  {
                      pivotGrid = App.Current.Windows[0].FindName("pivotGrid") as PivotGridControl;

                  }));
0
Comment
Question by:countrymeister
3 Comments
 
LVL 23

Accepted Solution

by:
wdosanjos earned 500 total points
ID: 39809349
Check out this thread, I think it's related to your problem: http://stackoverflow.com/questions/1226443/how-to-access-a-wpf-object-in-the-dispatcher
0
 
LVL 62

Expert Comment

by:Fernando Soto
ID: 39825834
Can you post a sample project that also encounters the same issue,
0
 
LVL 1

Author Closing Comment

by:countrymeister
ID: 39841812
helped a little
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now