Solved

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

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

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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Diagnostics with Net and Net.Sockets 2 28
Question! 4 36
Adding Existing Item to vb.net Project causes Errors 4 32
REXEX help Part 2 2 25
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…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

810 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