RenderTargetBitmap RenderAsync Value does not fall

2019-07-14 18:34发布

问题:

Using this guide: http://social.technet.microsoft.com/wiki/contents/articles/20648.using-the-rendertargetbitmap-in-windows-store-apps-with-xaml-and-c.aspx

I thought this would be a walk in the park until I got the error on this section:

await renderTargetBitmap.RenderAsync(grid_editor);

Here is my XAML

<Grid Name="grid_editor" Width="500" Height="500">
                        <Image x:Name="image_snap_preview" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Source="Assets/login/images/image (1).JPG"/>
                        <TextBlock Name="txt_123" Text="This text is on top of the image" FontSize="40" TextWrapping="Wrap" Margin="70"/>
                    </Grid>

It only has text and a image in it, for a test I had it not load the image I wanted into it and it still does not work. same error.

Code:

RenderTargetBitmap renderTargetBitmap = new RenderTargetBitmap();
            await renderTargetBitmap.RenderAsync(grid_editor);

            image_preview.Source = renderTargetBitmap;