I know how to make a snapshot in WPF.
draggableObject = new Image();
AssociatedObjectParent.Children.Add(draggableObject);
Grid panel = AssociatedObject as Grid;
draggableObject.Height = panel.ActualHeight;
draggableObject.Width = panel.ActualWidth;
DrawingVisual dv = new DrawingVisual();
using (DrawingContext dc = dv.RenderOpen())
{
VisualBrush vb = new VisualBrush(AssociatedObject);
dc.DrawRectangle(vb, null, new Rect(new Point(0,0), new Size(draggableObject.Width, draggableObject.Height)));
}
double x = draggableObject.Width;
double y = draggableObject.Height;
RenderTargetBitmap renderTargetTd = new RenderTargetBitmap((int)x, (int)y, 96, 96, PixelFormats.Default);
RenderOptions.SetBitmapScalingMode(renderTargetTd, BitmapScalingMode.Fant);
RenderOptions.SetEdgeMode(renderTargetTd, EdgeMode.Aliased);
renderTargetTd.Render(dv);
But now I have this ScrollViewer that is 600px wide and Content with 1000px. When I use this code and my horizontalOffset is 0 (so I haven't scrolled at all), then all is well and I get an image of the ScrollViewer-Control just fine.
However when I scroll my ScrollView and make a snapshot just the same way. The snapshot is all messed up.
How can I make a snapshot of the visible '400 to 1000' area of the scrollview content like I can with the '0 to 600' area of the scrollview?