Back to Devexpress

Printing and Exporting

wpf-118227-controls-and-libraries-map-control-end-user-interaction-printing-and-exporting.md

latest4.0 KB
Original Source

Printing and Exporting

  • Apr 01, 2021
  • 4 minutes to read

The Map control makes it possible to print a map and export it to numerous file formats.

Make sure that your project references the DevExpress.Xpf.Printing.25.2 and DevExpress.Printing.v25.2.Core assemblies to be capable to perform the following tasks.

Invoke the Print Preview Window

Use one of the following methods to invoke the Print Preview with a toolbar or the Print Preview with a Ribbon.

MethodDescription
MapControl.ShowPrintPreviewInvokes the Print Preview window, which shows the print preview of the Map control.
MapControl.ShowPrintPreviewDialogInvokes the modal Print Preview window, which shows the print preview of the Map control.
MapControl.ShowRibbonPrintPreviewInvokes the Print Preview window with a Ribbon for the Map control.
MapControl.ShowRibbonPrintPreviewDialogInvokes the Print Preview modal dialog with a Ribbon for the Map control.

The code below shows how to invoke the Print Preview form with the Ribbon on the button click event.

csharp
private void onButtonClick(object sender, RoutedEventArgs e) {
      mapControl.ShowRibbonPrintPreviewDialog(this);
}
vb
Private Sub onButtonClick(sender As Object, e As RoutedEventArgs)
    mapControl.ShowRibbonPrintPreviewDialog(Me)
End Sub

The Print Preview allows you to immediately print a map using default settings or to configure the required options before printing.

  1. To print a map using the default printer and predefined settings, click Quick Print.

  2. To change settings before printing, select the Print… item.

Export a Map

The Map control provides several ways to export a map.

  1. To export a map to the desired file format from code, use one of the following methods.

  2. You can export a map using the Print Preview window. To do this, select the desired format in the Export item’s drop-down list.

Configure Map Print/Export Settings

It is possible to change the map’s print/export options, for instance, size mode. To do this, use the following markup.

xaml
<dxm:MapControl x:Name="mapControl">
      <dxm:MapControl.PrintOptions>
            <dxm:MapPrintOptions SizeMode="Zoom" 
                                 PrintMiniMap="False"/>
      </dxm:MapControl.PrintOptions>
      <!--...-->
</dxm:MapControl>

The code above uses the following classes and properties.

Class or PropertyDescription
MapControl.PrintOptionsGets or sets print options of the Map control.
MapPrintOptionsStores map print options.
MapPrintOptions.PrintMiniMapSpecifies whether to print/export a mini map.
MapPrintOptions.SizeModeSpecifies a map size mode. To set this property, use items of the MapPrintSizeMode enumeration.

See Also

How to: Print a Map

How to: Export a Map

Document Preview