❔ Refresh WriteableBitmap
Hi,
I would like to use a WriteableBitmap in my application. However, the Image control does not update when the backing WriteableBitmap changes. The examples I could find online appear to use
WriteableBitmap.AddDirtyRect
to trigger the update. But in my case this does not nothing.
My control looks like this:
And the relevant code within the ViewModel:
5 Replies
it looks like what you want is WritableBitmap.Invalidate()
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.WriteableBitmap does not have a method called "Invalidate()". I tried using InvalidateVisual on the control, but that doesn't change anything either.
welp
so, based on the documentation, what you're supposed to do to get refreshes to trigger properly is either
A) use WritePixels() whenever you change the bitmap
B) Manually trigger refreshes of some or all of the bitmap with Lock()/AddDirtyRect()/Unlock()
preferrably A)
if either of those isn't doing it, I'd have to guess your setup is wrong
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.