Create Layer in different thread

10-11-2013 01:01 PM
Occasional Contributor II
I have a graphics layer that has many Graphics on it. This graphics may change depending on clients selection. Since it takes some time to recreate the graphics and add them to the layer, I thought it would be nice to just recreate the layer in a different thread, return it in the WorkItem of the thread that did the work and replace it in the map.

When I try to add the new layer to the Map though I get this error:

The calling thread cannot access this object because a different thread owns it

To try to solve this problem, I used the dispatcher of the Map like this:


And I got the same error. I also tried BeginInvoke and got the same result... So, basically the map cannot use that layer created in a different thread. How can I do this? Any suggestions?
0 Kudos
1 Reply
Occasional Contributor II
Anyone has any idea on this?
0 Kudos