Return Value
A Map
| Exception | Description |
|---|---|
| ArcGIS.Core.CalledOnWrongThreadException | This method or property must be called within the lambda passed to QueuedTask.Run. |
{
//Finding the first project item with name matches with mapName
MapProjectItem? mpi = Project.Current.GetItems<MapProjectItem>()
.FirstOrDefault(m => m.Name.Equals("The Map", StringComparison.CurrentCultureIgnoreCase));
var mapFromItem = await QueuedTask.Run(() => mpi?.GetMap());
if (mapFromItem != null)
{
//Open the map in a new map pane
//Must be called from the UI thread
await ProApp.Panes.CreateMapPaneAsync(map);
}
}
Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)