Thursday, October 13, 2011

Solving invalid cross-thread access

If you get this error in your code, try something like this (Credits to Justin Anderson):

add using directive:

using Microsoft.LightSwitch.Threading;

and write your code this way:

Dispatchers.Main.BeginInvoke(() =>
{
    // Your code
    UC a = new UC(parameters);
    a.Show();
});

No comments:

Post a Comment