Convert an IBuffer to a byte array in Windows Phone 8.1, how?

后端 未结 2 716
别跟我提以往
别跟我提以往 2021-02-13 00:22

I\'m writing an application for Windows Phone 8.1.

I need to save an UIElement as an image file (I\'d prefer JPG or PNG). I\'m using RenderTargetBitmap class to do this.

相关标签:
2条回答
  • 2021-02-13 00:25

    I just don't want to create new question so decide to expand this one. It will be full answer for both platforms WP8 and Windows store app

    Maybe you know how to convert IBuffer to byte[] in Windows Store App where we can't use this namespace: System.Runtime.InteropServices.WindowsRuntime

    Regards, Marcin

    Proposal solution: I use code from this post: https://stackoverflow.com/a/21490534/3139083

    Thanks

    0 讨论(0)
  • 2021-02-13 00:31

    This is available on Windows Phone 8.1, but it not available on WP 8.0. (see MSDN link)

    You need to make sure that you include the appropriate namespace however so it is found by the compiler:

    using System.Runtime.InteropServices.WindowsRuntime

    0 讨论(0)
提交回复
热议问题