countrymeister
asked on
The calling thread cannot access the object becuase a different thread owns it
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.Dispat cher.Invok e(System.W indows.Thr eading.Dis patcherPri ority.Norm al, new Action(
delegate()
{
pivotGrid = App.Current.Windows[0].Fin dName("piv otGrid") as PivotGridControl;
}));
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.Dispat
delegate()
{
pivotGrid = App.Current.Windows[0].Fin
}));
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Can you post a sample project that also encounters the same issue,
ASKER
helped a little