I want to pass a writeablebitmap object generated from UI (WPF) into an asynchronous call but don't want to update the main thread's writeablebitmap. I just want to read some properties such as pixel height and width. In the new thread I can't access any of the writeablebitmap's properties since it thinks I'm trying to mess with the main thread's writeablebitmap's properties. I receive the exception: "The calling thread cannot access this object because a different thread owns it." Some responses in other threads suggested they use Dispatcher.BeginInvoke
, but if I just want a copy of the writeablebitmap object to read data from, is this necessary?
Asked
Active
Viewed 344 times
1

Jack B
- 139
- 7
-
`Freezables` lose their thread-affinity when they're freezed. try calling `.Freeze()` in the `WritableBitmap`. Otherwise you can create a clone by using `.Clone()` and then freeze the clone. – Federico Berasategui Oct 02 '13 at 02:30
-
please mark my answer as accepted if it was useful you you =) – Federico Berasategui Oct 02 '13 at 03:05
1 Answers
1
Freezables
lose their Thread-affinity when they're freezed. try calling Freeze()
in the WritableBitmap.
Otherwise you can create a clone by using Clone()
and then freeze the clone

Federico Berasategui
- 43,562
- 11
- 100
- 154