Select to view content in your preferred language

Displayed field names on Legend

2898
1
03-21-2012 05:22 AM
Labels (1)
by Anonymous User
Not applicable
Original User: lisardggY

Hello, everyone.

I'm trying using the Legend control from the toolkit to show symbols and their associated values. But unlike the display in the ArcEditor/ArcMap, the legend displays the field values only, not the names of the fields. Here's how it looks in my app:
[ATTACH=CONFIG]12894[/ATTACH]

vs. how it looks in the official ESRI tools:
[ATTACH=CONFIG]12895[/ATTACH]

I looked through the properties of the LayerItemViewModel and LegendItemViewModel, but couldn't find anywhere where the field names (Severity,Escalated,Closed) are specified, to add them to my MapLayerItemTemplate. Am I missing something?
0 Kudos
1 Reply
by Anonymous User
Not applicable
Original User: lisardggY

I've managed to solve this problem. It seems I can get the field names for the legend by accessing the layer's Renderer.

if (layer.Renderer is UniqueValueRenderer)
{
    return (layer.Renderer as UniqueValueRenderer).Field;
}
else if (layer.Renderer is UniqueValueMultipleFieldsRenderer)
{
    var renderer = layer.Renderer as UniqueValueMultipleFieldsRenderer;
    return string.Join(r.FieldDelimiter, r.Fields);
}
0 Kudos