Hi
Could you please assist with how we can fetch legends from the Map Tiles service?
Below is the sample code, we have consumed the tile by URL which is rendered successfully to the map view.
ArcGISTiledLayer layer = new ArcGISTiledLayer(new Uri(LayerUrl)) ;
await baseLayer.LoadAsync();
var legends = layer.GetLegendInfosAsync();
However, GetLegendInfosAsync() does not return the legend associated with the tile service.
Thanks 🙂 in advance
Solved! Go to Solution.
'await' is missing in your code, the task is not executed yet at your debug point.
var legend = await sublayer.GetLegendInfosAsync();
The legend is provided by sublayers so you have to get the SubLayers, loop on the sublayers, and call GetLegendInfosAsync on each sublayer (even if frequently a tiled layer has only one sublayer)
Thanks for your response. After trying GetLegendInfosAsync () on the sublayer it returned null as a result and Status as Waiting for Activation. Anything we need to configure on on the Tile Service? see below snapshot
'await' is missing in your code, the task is not executed yet at your debug point.
var legend = await sublayer.GetLegendInfosAsync();