This is my first question on stackoverflow. I'm new to UWP programming, and due to some reason I need to do it in C++. Now I'm trying to solve this problem: I've got a byte array of images and want to show them in the UI. The following code is what I've tried but seems don't work. Here is C++ code:
BYTE input[160000] = ...;
InMemoryRandomAccessStream ^stream = ref new InMemoryRandomAccessStream();
DataWriter ^writer = ref new DataWriter();
writer->WriteBytes(Platform::ArrayReference<BYTE>(input, sizeof(input)));
stream->WriteAsync(writer->DetachBuffer());
stream->Seek(0);
BitmapImage ^image = ref new BitmapImage();
image->SetSourceAsync(stream);
outputPic->Source = image;
Here is xaml code:
<Image x:Name="outputPic" Source="Assets/Gray.png" Width="420" Stretch="Uniform" Height="420"/>

create_task(image->SetSourceAsync(stream)).then([](void) { outputPic->Source = image; });. And similar for any other asynchronous calls like WriteAsync.