Sets the
Map associated with the MapFrame. This method must be called on the MCT. Use QueuedTask.Run.
MapFrame_SetMap
//Set the map that is associated with a map frame.
//Perform on worker thread
await QueuedTask.Run(() =>
{
mf.SetMap(map);
});
Change the map associated with a map frame
//Change the map associated with a map frame
//Reference a map frame on a layout
MapFrame mfrm = layout.FindElement("Map Frame") as MapFrame;
//Perform on worker thread
await QueuedTask.Run(() =>
{
//Reference map from the project item
Map map = Project.Current.GetItems<MapProjectItem>().FirstOrDefault(m => m.Name.Equals("Map1")).GetMap();
//Set the map to the map frame
mfrm.SetMap(map);
});
Target Platforms: Windows 11, Windows 10
ArcGIS Pro version: 3 or higher.