In WinRT C# how do I save an offscreen XAML tree using RenderTargetBitmap?

前端 未结 2 1650
盖世英雄少女心
盖世英雄少女心 2021-01-03 00:08

The following code throws a cryptic System.ArgumentException from the RenderAsync method \"Value does not fall within the expected range.\" If on the other hand my Canvas is

2条回答
  •  隐瞒了意图╮
    2021-01-03 00:49

    WinRTXamlToolkit.Composition namespace has this extension that works. Just call this method:

    await WriteableBitmapRenderExtensions.RenderToPngStream(element);
    

提交回复
热议问题