Is it possible to create and render a UI Xaml control independently of a page?
Take the example of a UWP unit test...
[TestMethod]
public async Task TestWebView()
{
var taskSource = new TaskCompletionSource<object>();
await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(
CoreDispatcherPriority.Normal, async () =>
{
try
{
var text = new TextBox();
text.Text = "hello";
var renderer = new RenderTargetBitmap();
await renderer.RenderAsync(text);
}
catch (Exception e)
{
taskSource.SetException(e);
}
});
await taskSource.Task;
}
This example throws following exception upon calling RenderAsync
:
System.ArgumentException: Value does not fall within the expected range.