wpf-118227-controls-and-libraries-map-control-end-user-interaction-printing-and-exporting.md
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.
Use one of the following methods to invoke the Print Preview with a toolbar or the Print Preview with a Ribbon.
| Method | Description |
|---|---|
| MapControl.ShowPrintPreview | Invokes the Print Preview window, which shows the print preview of the Map control. |
| MapControl.ShowPrintPreviewDialog | Invokes the modal Print Preview window, which shows the print preview of the Map control. |
| MapControl.ShowRibbonPrintPreview | Invokes the Print Preview window with a Ribbon for the Map control. |
| MapControl.ShowRibbonPrintPreviewDialog | Invokes 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.
private void onButtonClick(object sender, RoutedEventArgs e) {
mapControl.ShowRibbonPrintPreviewDialog(this);
}
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.
To print a map using the default printer and predefined settings, click Quick Print.
To change settings before printing, select the Print… item.
The Map control provides several ways to export a map.
To export a map to the desired file format from code, use one of the following methods.
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.
It is possible to change the map’s print/export options, for instance, size mode. To do this, use the following markup.
<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 Property | Description |
|---|---|
| MapControl.PrintOptions | Gets or sets print options of the Map control. |
| MapPrintOptions | Stores map print options. |
| MapPrintOptions.PrintMiniMap | Specifies whether to print/export a mini map. |
| MapPrintOptions.SizeMode | Specifies a map size mode. To set this property, use items of the MapPrintSizeMode enumeration. |
See Also