Select to view content in your preferred language

ArcGISRuntime.Toolkit.WPF legend not showing the symbols

265
1
Monday
Labels (1)
MichaelChau1
New Contributor

Hi, I'm new to ArcGIS and I'm trying to make use of the legend control from Esri.ArcGISRuntime.Toolkit.WPF, 200.8.0.  The map shows the symbols as expected, but the legend only shows the names of the layer and not the symbols.  I have 21 symbols defined in the ORDERS style, and 31 symbols defined for the USERS style.

XAML for the map and legend:

<esri:MapView x:Name="MainMapView" 
              Grid.Row="1"
              Map="{Binding Map, Source={StaticResource MapViewModel}}" 
              GraphicsOverlays="{Binding GraphicsOverlays, Source={StaticResource MapViewModel}}" >            
</esri:MapView>

<esri:Legend x:Name="MainLegend" Grid.Row="1" GeoView="{Binding ElementName=MainMapView}" VerticalAlignment="Bottom" HorizontalAlignment="Right" Visibility="Visible"/>

 

Code creating the feature layer:

_geodatabase = await Geodatabase.OpenAsync(mobileGdbPathName);

foreach (var table in _geodatabase.GeodatabaseFeatureTables)
{
    if (table.TableName.Equals(MY_FEATURE_LAYER_NAME))
    {
        await table.LoadAsync();
        _myFeatureLayer = new FeatureLayer(table);
        DictionarySymbolStyle myLocalStyle = 
            await DictionarySymbolStyle.CreateFromFileAsync(myStylxPath);
        _myFeatureLayer.Renderer = new DictionaryRenderer(myLocalStyle);
        this.Map.OperationalLayers.Add(_myFeatureLayer);
    }
}

 

In case you are confused by the "WinFormMapCtrl" title, this is just a WinForm hosting the WPF map control.

MichaelChau1_1-1756159109107.png

Any help would be much appreciated.

Michael

 

0 Kudos
1 Reply
dotMorten_esri
Esri Notable Contributor

If I'm not mistaken, Legend isn't supported for a DictionaryRenderer. Try calling _myFeatureLayer.GetLegendInfosAsync() and see if it returns anything.

0 Kudos