You can use RandomAccessStreamReference.CreateFromStream
to create a IRandomAccessStreamReference for AppendResultSuggestion
you only need a RandomAccessStream containing the image data.
For that you can use following method:
private async Task<InMemoryRandomAccessStream> CreateInMemoryImageStream(Color fillColor, uint heightInPixel, uint widthInPixel)
{
var stream = new InMemoryRandomAccessStream();
var encoder = await BitmapEncoder.CreateAsync(BitmapEncoder.JpegEncoderId,stream);
List<Byte> bytes = new List<byte>();
for (int x = 0; x < widthInPixel; x++)
{
for (int y = 0; y < heightInPixel; y++)
{
bytes.Add(fillColor.R);
bytes.Add(fillColor.G);
bytes.Add(fillColor.B);
bytes.Add(fillColor.A);
}
}
encoder.SetPixelData(BitmapPixelFormat.Rgba8, BitmapAlphaMode.Ignore, widthInPixel, heightInPixel, 96, 96, bytes.ToArray());
await encoder.FlushAsync();
return stream;
}
After that you can call:
args.Request.SearchSuggestionCollection.AppendResultSuggestion("Green", string.Empty, string.Empty, await CreateInMemoryImageStream(Colors.Green), string.Empty);
I know it looks quite hacky but it works like a charm!