The calling thread cannot access the object becuase a different thread owns it
Posted on 2014-01-24
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(
pivotGrid = App.Current.Windows.FindName("pivotGrid") as PivotGridControl;