ArcGIS Pro 2.4 API Reference Guide
GetMapView Method

ArcGIS.Desktop.Layouts Namespace > MapFrame Class : GetMapView Method
Gets the map Frame's viewer on the specified layout pane.
Public Function GetMapView( _
   ByVal layoutView As LayoutView _
) As MapView
public MapView GetMapView( 
   LayoutView layoutView



Return Value

Returns a MapView.
Note: the layout pane containing the viewer must be open. To navigate the map frame without an open layout pane, use the map frame's camera instead.
//Export the map view associated with a map frame to BMP.

//Create BMP format with appropriate settings
//EMF, EPS, GIF, JPEG, PDF, PNG, SVG, TGA, and TFF formats are also available for export
BMPFormat BMP = new BMPFormat()
  Resolution = 300,
  Height = 500,
  Width = 800,
  HasWorldFile = true,
  OutputFileName = filePath

//Reference the active layout view
LayoutView lytView = LayoutView.Active;

//Reference the map frame and its map view
MapFrame mf_bmp = layout.FindElement("Map Frame") as MapFrame;
MapView mv_bmp = mf_bmp.GetMapView(lytView);

if (mv_bmp != null)
  //Export on the worker thread
  await QueuedTask.Run(() =>

    //Check to see if the path is valid and export
    if (BMP.ValidateOutputFilePath())
      mv_bmp.Export(BMP);  //Export to BMP

Target Platforms: Windows 10, Windows 8.1, Windows 7

See Also


MapFrame Class
MapFrame Members