AnsweredAssumed Answered

Load GroupLayer in code on startup

Question asked by ChristinaElaine on Oct 14, 2015
Latest reply on Oct 15, 2015 by FGibson-esristaff

I have an offline .mpk that I would like to load into a GroupLayer on startup (not in xaml). I am doing this in my ViewModel. If I add the ArcGISDynamicMapServiceLayer directly to the Map.Layers, it works fine. If I add the GroupLayer first and then add the dynamic layer, it doesn't work and I get a spatial reference error. So, I tried to set the SpatialReference on the Map before adding the GroupLayer, and it works for adding the GroupLayer but then I get the spatial reference error when the dynamic layer is added. I also tried adding the dynamic layer to the GroupLayer first and then adding the GroupLayer to the Map.Layers, but that also failed and gave me the spatial reference error.


How can I add a GroupLayer containing an ArcGISDynamicMapServiceLayer on startup??