Layer l = Map.Layers[0] if (l is ArcGISLocalDynamicMapServiceLayer) { ArcGISLocalDynamicMapServiceLayer localDyn = l as ArcGISLocalDynamicMapServiceLayer; foreach (LayerDetails ld in localDyn.Service.MapLayers) { ... } }
Hi,
Unfortunately there's nothing currently in the API to retrieve the existing renderer for layers within a local map service. However, you should be able to construct the URL for a REST request to the ...\MapServer endpoint and download the JSON as a string which will contain the rendering information. The Renderer class has a FromJson method which enables you to reconstruct the renderer from the downloaded JSON.
public MainWindow() { InitializeComponent(); _map.Layers.LayersInitialized += (s, e) => { ArcGISLocalDynamicMapServiceLayer localDynamicServiceLayer = _map.Layers["USA"] as ArcGISLocalDynamicMapServiceLayer; IRenderer renderer; FeatureLayer featureLayer = new FeatureLayer() { Url = localDynamicServiceLayer.Url + "/0" }; featureLayer.Initialized += (fLayer, eventArgs) => { if (featureLayer.Renderer != null) { // Do Something with Renderer. renderer = featureLayer.Renderer; } }; featureLayer.Initialize(); }; }