Select to view content in your preferred language

Xamarin version 100.1 displayfield for layer from ArcGISMapImageLayer

780
1
01-10-2018 02:01 PM
GregorySayre
Emerging Contributor

In version 100.1, is there a way to get the display field for a layer in an ArcGISMapImageLayer?  It's connecting and drawing fine and I can view ALL the fields for a feature, but I don't know which field is the DisplayField.

var dynamicMapUrl = new Uri(SettingHelper.GisSettings.MapServiceUrl);

dynamicLayer = new ArcGISMapImageLayer(dynamicMapUrl) {Opacity = Constants.EsriMap.DynamicLayerOpacity};

_map.Basemap.BaseLayers.Add(dynamicLayer);

// Make sure that layer and it's sublayers are loaded

await dynamicLayer.LoadAsync();

                // step through the map layers and save current visibility

foreach (ArcGISSublayer baselayer in dynamicLayer.Sublayers)

{

                    MapLayerViewModel parentLayer = new MapLayerViewModel();

                    parentLayer.Id = baselayer.Id;

                    parentLayer.Text = baselayer.Name;

                    parentLayer.IsSelected = baselayer.IsVisible;

                    //parentLayer.DisplayField = ?????????? //HOW DO I GET THIS?

}

0 Kudos
1 Reply
GregorySayre
Emerging Contributor

I figured out a way to load the DisplayFieldName from the dynamic layers.  I had to load information for EACH layer individually though.

In case anyone else gets stuck on this: (this only does parent and one level of child layers)

                await dynamicLayer.LoadAsync();

                foreach (Esri.ArcGISRuntime.Mapping.ArcGISSublayer sublayer in dynamicLayer.Sublayers)

                {

                        String S = sublayer.DefinitionExpression;

                        await sublayer.LoadAsync();

                        String displayFieldName = sublayer.MapServiceSublayerInfo.DisplayFieldName;

                        foreach (Esri.ArcGISRuntime.Mapping.ArcGISSublayer sublayer2 in sublayer.Sublayers)

                        {

                            await sublayer2.LoadAsync();

                            String S2 = sublayer2.DefinitionExpression;

                            String displayFieldName2 = sublayer2.MapServiceSublayerInfo.DisplayFieldName;

                        }

                }

0 Kudos