Use RenderTargetBitmap
For example, a test with a Button saved to a .PNG image =>
Microsoft.UI.Xaml.Media.Imaging.RenderTargetBitmap renderTargetBitmap = new Microsoft.UI.Xaml.Media.Imaging.RenderTargetBitmap();
await renderTargetBitmap.RenderAsync(myButton);
var pixelBuffer = await renderTargetBitmap.GetPixelsAsync();
Windows.Storage.StorageFolder folder = await Windows.Storage.StorageFolder.GetFolderFromPathAsync(@"E:\");
var destfile = await folder.CreateFileAsync("controlimage.png", Windows.Storage.CreationCollisionOption.ReplaceExisting);
using (var ras = await destfile.OpenAsync(Windows.Storage.FileAccessMode.ReadWrite, Windows.Storage.StorageOpenOptions.None))
{
Windows.Graphics.Imaging.BitmapEncoder encoder = await Windows.Graphics.Imaging.BitmapEncoder.CreateAsync(Windows.Graphics.Imaging.BitmapEncoder.PngEncoderId, ras);
encoder.SetPixelData(Windows.Graphics.Imaging.BitmapPixelFormat.Bgra8, Windows.Graphics.Imaging.BitmapAlphaMode.Straight, (uint)renderTargetBitmap.PixelWidth, (uint)renderTargetBitmap.PixelHeight, 96.0, 96.0, pixelBuffer.ToArray());
await encoder.FlushAsync();
}