I'm wondering, is there a way to save a WpfMap to a bitmap without the window ever being visible? The idea would be to make a new WpfMap object, set the extent(and whatever else needs to be set), and then save it like a normal Visual. Here's some code to sort of show the idea, and the extent is being set to the bounding box given by geocoding "Cherokee TX" just to have an extent set to something:
private void SaveBMPWithoutWindow()
{
Canvas canvas = new Canvas();
System.Windows.Size size = new System.Windows.Size(800, 600);
WpfMap map = new WpfMap();
map.Width = size.Width;
map.Height = size.Height;
map.CurrentExtent = new RectangleShape("POLYGON((-98.724832 30.999371, -98.691047 30.999371, -98.691047 30.965587, -98.724832 30.965587, -98.724832 30.999371))");
canvas.Children.Add(map);
canvas.Measure(size);
canvas.Arrange(new Rect(size));
RenderTargetBitmap bitmap = new RenderTargetBitmap((int)size.Width, (int)size.Height, 96, 96, PixelFormats.Default);
bitmap.Render(map);
BitmapEncoder image = new BmpBitmapEncoder();
image.Frames.Add(BitmapFrame.Create(bitmap));
using (Stream fs = File.Create(filepath))
{
image.Save(fs);
}
}