Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
var view = item.Content;
if (view.Contains(StandardDataFormats.Bitmap))
{
var bitmapReference = await view.GetBitmapAsync();
if (bitmapReference != null)
{
var bitmap = new BitmapImage();
await bitmap.SetSourceAsync(await bitmapReference.OpenReadAsync());
viewer.ContentGrid.Children.Add(new Image() { Width = 300, Height = 300, Stretch = Stretch.None, Source = bitmap });
}
}
else if (view.Contains(StandardDataFormats.Text))
{
var text = await view.GetTextAsync();
if (text != null)
{
viewer.ContentGrid.Children.Add(new TextBlock() { Text = text });
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment