AnsweredAssumed Answered

Error Creating a Map

Question asked by Mitch954 on Feb 2, 2018
Latest reply on Feb 5, 2018 by gkmieliauskas_cellexp

"This method or property must be called on the thread this object was created on.


I get this exception when creating a Map object either from an existing map or creating a new map.


Map map = null;
var mapProjectItems = Project.Current.GetItems<MapProjectItem>();
if (mapProjectItems.Count() > 0)
var mapProjectItem = mapProjectItems.First();
//FirstOrDefault(mpi => mpi.Name.Equals("World Map"));
map = mapProjectItem.GetMap();
map = MapFactory.Instance.CreateMap("World Map", ArcGIS.Core.CIM.MapType.Map, ArcGIS.Core.CIM.MapViewingMode.Map, Basemap.Terrain);