WPF Take screenshot from other thread than main thread
I have a thread that listens for commands to my WPF application. If the WPF Application gets a command to take a screenshot the task is handed over to a "screenshotService". I found som code to take the screenshot somewhere on the interweb, seems to work, but i havent thought it through....i cannot take this screenshot from another thread, giving this exception:

    {"This API was accessed with arguments from the wrong context."}

Left to say is that the signature of my screenshot method takes a UIElement from the UI, this grid is always the same one, and is pased to the constructor of the takeScreenshot method.

How would I go around and take this screenshot? 
WPF Take screenshot from other thread than main thread
===

I have a thread that listens for commands to my WPF application. If the WPF Application gets a command to take a screenshot the task is handed over to a "screenshotService". I found som code to take the screenshot somewhere on the interweb, seems to work, but i havent thought it through....i cannot take this screenshot from another thread, giving this exception:

    {"This API was accessed with arguments from the wrong context."}

Left to say is that the signature of my screenshot method takes a UIElement from the UI, this grid is always the same one, and is pased to the constructor of the takeScreenshot method.

How would I go around and take this screenshot? 