Strange. The code to enable the print command is quite simple: private bool CanPrint(object param) { return IsPrinting == false && Map != null; } So very likely the Map property is null, but I can't figure out why. If you want, send me your code by mail dbroux@esri.com, I'll take a look.
private bool CanPrint(object param) { return IsPrinting == false && Map != null; }
Hi Kevin,Thank you for your nice feedback.The command is disabled if the map attached to the map printer is null or is being printed.I guess your issue is coming from the map binding. Check that the map element name (Map is this sample) is the right one: <esri:Map x:Name="Map" Background="White" Extent="-400000, 5230000, 840000, 6870000"> <esri:ArcGISTiledMapServiceLayer ID="Basemap" Url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer" /> <esri:ArcGISDynamicMapServiceLayer ID="TourDeFrance" Url="http://88.191.74.143/ArcGIS/rest/services/TourDeFrance2010/MapServer" Opacity="1.0" /> </esri:Map> .......... <controls:PrintPreview x:Name="PrintPreview"> <controls:MapPrinter x:Name="mapPrinterWithPreview"Map="{Binding ElementName=Map}" PrintDocumentName="Tour de France 2010" IsActive="True" Height="1050" Width="750" BorderBrush="#20000080" BorderThickness="2" Foreground="White" Background="{StaticResource CommonBackgroundBrush}" /> </controls:PrintPreview> No clue without more info. I suggest you set IsActive to True, so you should see the print preview without using the button. (You might also try to set the Visibility of the PrintPreviewPanel to 'Visible' instead of using a binding : <local:WindowPanel x:Name="PrintPreviewPanel" Width="340" Height="405" Effect="{StaticResource dropShadow}" Background="{StaticResource CommonBackgroundBrush}" Visibility="Visible" VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,60,10,0" BorderBrush="{StaticResource CommonBorderBrush}"> ).
<esri:Map x:Name="Map" Background="White" Extent="-400000, 5230000, 840000, 6870000"> <esri:ArcGISTiledMapServiceLayer ID="Basemap" Url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer" /> <esri:ArcGISDynamicMapServiceLayer ID="TourDeFrance" Url="http://88.191.74.143/ArcGIS/rest/services/TourDeFrance2010/MapServer" Opacity="1.0" /> </esri:Map> .......... <controls:PrintPreview x:Name="PrintPreview"> <controls:MapPrinter x:Name="mapPrinterWithPreview"Map="{Binding ElementName=Map}" PrintDocumentName="Tour de France 2010" IsActive="True" Height="1050" Width="750" BorderBrush="#20000080" BorderThickness="2" Foreground="White" Background="{StaticResource CommonBackgroundBrush}" /> </controls:PrintPreview>
<local:WindowPanel x:Name="PrintPreviewPanel" Width="340" Height="405" Effect="{StaticResource dropShadow}" Background="{StaticResource CommonBackgroundBrush}" Visibility="Visible" VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,60,10,0" BorderBrush="{StaticResource CommonBorderBrush}">
What determines if the control bound to PrintCommand will be enabled or disabled?
my print_preview button (utilizing your ToggleVisibilityAction) doesn't do anything
I just posted the print sample on the ArcGIS.com code gallery : http://www.arcgis.com/home/item.html?id=e361c2cc69784fcba34358d0458f66e3It would have needed a few code refactoring and clean-up but as I am in vacations 🙂 during the next 2 weeks:), I'd rather to post it as is. So I'll get your feedbacks when I am back.
Excellent example. My only question remains how can I generate images large enough to be printed on for example A0 paper?
I am going to write a print sample (at the client side) which is multi pages and printing at fixed scale.A first version is available here : http://broux.dominique.free.fr/Silverlight/MapPrinting/MapPrinting.htmlYour feedback would be appreciated.I will post the code soon Note : The print extent is the current map extent at the time the preview window is opened. I guess, a way to change the print extent from the preview would be useful.
Přihlášení členové mohou přispívat, sledovat aktualizace a další. Jste tu noví? Zaregistrujte si bezplatný účet.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.