Initializing map from map package

Discussion created by azlotinesri-ca-esridist Employee on Sep 28, 2017
Latest reply on Oct 3, 2017 by azlotinesri-ca-esridist

I am using the following code to load map from a mobile package:


MobileMapPackage mmpk = await MobileMapPackage.OpenAsync(packagePath);
Map map = mmpk.Maps[0];
MainMapView.Map = map;


while (Double.IsNaN(MainMapView.MapScale))
scale.Text = Convert.ToInt32(MainMapView.MapScale).ToString("N0");


After the map is assigned to the map view, I expect the view to initialize and return a valid MapScale. This does not happen however, the while loop above is never exited. If I comment out the three lines above, the map is loaded in the view as expected, but a valid MapScale is returned only after I pan or zoom the map. Is there a way to access MapScale immediately after the map is loaded?


Any suggestions are welcome. I am using WPF Runtime 100.1.0.