DependencyObject
is a subclass of DispatcherObject
; these objects are tied to the thread that created them. You can't access their dependency properties directly from another thread. If you need a worker thread to access a dependency property of a DispatcherObject
, you need to use Dispatcher.Invoke
to invoke the action on the dispatcher thread.
Cannot use DependencyObject from other thread
-
15-07-2023 - |
Question
This error appear only when I add these lines to my OnRender override method:
for (int i = 0; i < this.Width; i++)
{
dc.DrawImage(Gouttes[i].Bitmap, new Rect(i, Gouttes[i].Y, 1, Gouttes[i].Length));
}
and Visual Studio says me it comes from
new Application().Run(new MainWindow());
which work either...
Please help me: what cause that error and how to fix it ?
Thanks a lot to all that will help me :)
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow