I'm adding a TPK layer with spatial reference "WGS84 Web Mercator Auxilary Sphere" to a map and the SpatialReference of the map and mapview still has null for the spatial reference. According to the online help, I thought that if you add a layer to your map, it takes the spatial reference of that layer:
To set the SpatialReference of the MapView, a Map must be added to the MapView.Map Property and either: (1) the InitialViewpoint must be set (including the Envelope's Extent and SpatialReference) or (2) at least one layer (which has SpatialReference information) must be added to the Map's LayerCollection (typically via the Map.Layers.Add() Method).
So first, after looking at the tpk in ArcMap, it does say it has spatial reference Web Mercator mentioned above. In the XAML I created a MapVIew (called mapViewMain) and then a map inside the MapView (called mapMain). In the code I do:
ArcGISLocalTiledLayer tLayer = new ArcGISLocalTiledLayer(filename);tLayer.ID = strName;tLayer.DisplayName = strName;mapViewMain.Map.Layers.Add(tLayer);
After doing this my mapViewMain and mapMain both have Spatial Reference of null. Am I doing something wrong or forgetting something?