0

I was reading up on RenderTargetBitmap for a bug in one of my UWPs where a captured image wasn't displaying correctly. Came across a remark from Microsoft stating RenderTargetBitmap can lose data for some reason or another and that we should be attempting to render the bitmap a second time using CompositionTarget.SurfaceContentsLost event. But I haven't been able to find an example of this event online. And I can't seem to request feedback from Microsoft at this time on their Knowledge base site. Does anyone have some sample code they would be willing to share?

Thank you.

1 Answers1

0

But I haven't been able to find an example of this event online.

There's a ImageSourceUpdateRegion sample in Win2D-UWP-Samples. It registers the CompositionTarget.SurfaceContentsLost event in UserControl_Loaded. You could check this sample to learn how to use this event for your UWP app.

Xie Steven
  • 8,544
  • 1
  • 9
  • 23
  • 1
    Thanks for finding the example. I followed the directions, but my event never fired when it should have on a `Page` in my UWP. At this point I am just going to start pulling out UI elements until `RenderTargetBitmap` stabilizes. – Stoic Developer Nov 02 '18 at 17:02