How to synchronize the MapControl and PageLayoutControl


SummaryA common task for an ArcGIS Engine developer is to synchronize (in the same application) the map used by the MapControl with the focus map of the PageLayoutControl. This topic discusses the methods used to achieve this synchronization.

Development licensing Deployment licensing
Engine Developer Kit ArcView
ArcEditor
ArcInfo
Engine Runtime

Synchronizing the MapControl and PageLayoutControl

A common task for an ArcGIS Engine developer is to synchronize (in the same application) the map used by the MapControl with the focus map of the PageLayoutControl. For example, an application may have one tab containing a MapControl and one tab containing a PageLayoutControl, both displaying the same map data. Any changes made to a map in one control must be reflected in the other control when its tab is activated.
 
Consider the following differences between the ArcMap desktop application and the ArcGIS Engine controls:
 
The synchronization that ArcMap provides can be implemented with the MapControl and PageLayoutControl as follows:
 
The Synchronized MapControl and PageLayoutControl sample synchronizes the map used by MapControl and the focus map of the PageLayoutControl using a ControlsSynchronizer class that is implemented as previously described. This class can be used in custom applications using the following steps:
  1. Create an instance of the ControlsSynchronizer and pass in the MapControl and PageLayoutControl.
  2. Call the BindControls method.
  3. Call the AddFrameworkControl method to add any framework controls (ToolbarControl or TOCControl) to work with the MapControl and PageLayoutControl.
  4. Call ActivateMap when switching to the MapControl, and call ActiavtePageLayout when switching to the PageLayoutControl.