且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何从Dispatcher线程访问单独的线程生成的WPF UI元素?

更新时间:2023-01-13 09:47:02

找到了另一个问题完全相同的人-此处是真正的救星. 现在,我不再尝试从Dispatcher线程访问由辅助线程生成的UI元素,而是现在在辅助线程上执行其余的打印过程. UI元素没有跨线程的"VerifyAccess",并且工作正常. :)

Found another guy with exactly the same problem - Printing the content of a DocumentViewer in a different UI thread. Just followed the same path. The code here was a real savior.
Now I'm NOT trying to access the secondary thread generated UI element from the Dispatcher thread, instead now the rest of the printing procedure is executed on the secondary thread. No cross-thread "VerifyAccess" of UI elements, and It's working smoothly. :)