private static RenderTargetBitmap Get3DVisual(FrameworkElement element)
{
var width = element.ActualWidth;
var height = element.ActualHeight;
var bmpCopied = new RenderTargetBitmap((int) Math.Round(width), (int) Math.Round(height), 96, 96,
PixelFormats.Default);
var dv = new DrawingVisual();
using (var dc = dv.RenderOpen())
{
var vb = new VisualBrush(element);
dc.DrawRectangle(vb, null, new Rect(new System.Windows.Point(), new Size(width, height)));
}
bmpCopied.Render(dv);
return bmpCopied;
}