Select to view content in your preferred language

Printing Sample & MapUnits, Scalebar, etc

682
3
11-16-2011 12:09 PM
LanceCrumbliss
Frequent Contributor
Hello All,

I've downloaded and compiled the latest print sample by dbroux. 

Using it, I noticed the print to scale functionality didn't work.  Poking around I noticed it was because the MapUnits was being detected as "Undefined" by the MapPrinter control.  Manually setting that to "Feet" in XAML resolved that. (The Projection is nothing weird, it's a state plane zone) However, two issue still remain:


  • the scalebar on the printout just shows NaN.  I know what the means, but why?


  • I cannot pan the map in the MapPrinterDialog window.  I can zoom in and out with the mouse wheel, but that's it.

I'm sure they're all related.

            <printing:MapPrinterDialog x:Name="MapPrinterDialog" Width="340" Height="405" Background="{x:Null}" Foreground="White" >
                <printing:MapPrinter x:Name="mapPrinterWithDialog" Map="{Binding ElementName=MyMap}" IsActive="{Binding ElementName=btnPrint, Path=IsChecked }" MapUnits="Feet" />
            </printing:MapPrinterDialog>
0 Kudos
3 Replies
DominiqueBroux
Esri Frequent Contributor

the scalebar on the printout just shows NaN. I know what the means, but why?

You likely need to set the 'MapUnit' property of the scalebar control, just as you did for the MapPrinter control.


I cannot pan the map in the MapPrinterDialog window. I can zoom in and out with the mouse wheel, but that's it.

Is there a scrollviewer in your visual tree that could catch the click events?
Try as well by removing the null background you set (Background="{x:Null}" ), this might be the reason the click events are not fired.
0 Kudos
LanceCrumbliss
Frequent Contributor
You likely need to set the 'MapUnit' property of the scalebar control, just as you did for the MapPrinter control.


Ok, where...in the template of the MapPrinter control?  EDIT:  That's exactly where I changed it and the scalebar works now.

Is there a scrollviewer in your visual tree that could catch the click events?
Try as well by removing the null background you set (Background="{x:Null}" ), this might be the reason the click events are not fired.


Unfortunately, changing the background color had no effect.  The MapPrinterDialog control is contained within a custom movable window control (like the "WindowPanel" user control in the Print Sample Project).  However, in our version, the ContentPresenter of that control is contained within a ScrollViewer.  So yes, I guess there is a ScrollViewer in the Visual Tree.  That may be the cause.  How can that be resolved (without removing the ScrollViewer from the equation)?
0 Kudos
LanceCrumbliss
Frequent Contributor
Got it working.  I created another template for the movable window that didn't have the ContentPresenter in a ScrollViewer and used that for the MapPrinterDialog's parent.
0 Kudos