In WinRT, how do I load an image and then wait only as long as is needed for it to load before writing to it?

后端 未结 3 1289
有刺的猬
有刺的猬 2021-01-15 13:51

I\'m using WriteableBitmapEx in a WinRT project. I load an image into a WriteableBitmap from the users Picture library. However, I cannot then immediately write to that im

3条回答
  •  深忆病人
    2021-01-15 14:16

    I don't think WB has the events that BitmapImage does to wait for it to open. I would try using BitmapDecoder/CreateAsync/GetPixelDataAsync/DetachPixelData and copy resulting byte array to the WB's pixel buffer instead of calling wb.SetSource(). Then maybe call wb.Invalidate(). Or maybe just replace the Delay call with an Invalidate one.

提交回复
热议问题