Topics: WPF
Mar 5, 2012 at 3:00 PM

I'm trying to print the map (with markers overlaid) using the standard

            PrintDialog printDlg = new PrintDialog();
            printDlg.PrintVisual(MainMap, "Map Printing.");

but it fails with the infamous "the calling thread cannot access this object because a different thread owns it." error. 

There was a brief discussion of this issue over a year ago (in the Windows Forms section, strangely), but no solution was forthcoming at that time. So has this been resolved, or can you please suggest a way to print the map in WPF?

Mar 5, 2012 at 4:00 PM


var img = map.ToImageSource();
PrintDialog printDlg = new PrintDialog();
printDlg.PrintVisual(img, "Map Printing.");


Mar 6, 2012 at 10:33 AM

Ah, just the job. Thanks :)

Nov 25, 2012 at 10:54 PM

Hello Radioman

I'm also interested by printing map, but on my version of the dll there is no ToImageSource() method but just ToImage()

Is it the same ?
Do I make a mistake somewhere ?



Nov 26, 2012 at 7:40 AM

it's the same

Nov 26, 2012 at 8:54 PM

Hello Radioman

Now I see some issues  with map.ToImage()

- It is not really a ToImage() from backround map, but a ToImage from the viewPort, as a PrintScreen embedding everything Visible on the screen

- My Idea was to change zoom and Size to print a readeable map on a full A4 page centered on the visible map on the screen, but what I get is just a kind of PrintScreen of the viewport

- Is there any other way to Get the map displayed or even better get a map for defined Area in order to print or save the image ?

- Obviously I can dive into the code but do you provide some other way to get a map for Printing or Image saving purpose ?

Thank for your help



Nov 26, 2012 at 9:12 PM

check windows forms demo, 'Get static' button