Solved

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

Posted on 2014-01-24
3
241 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Need to pass a connection through class/Method 1 39
Error in page 3 45
Class object 2 26
ASP.NET 5 Templates 2 65
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

911 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

18 Experts available now in Live!

Get 1:1 Help Now