Select to view content in your preferred language

Show default symbols in Legend

709
1
04-05-2011 04:42 AM
SantoshV
Emerging Contributor
Hi,
I am using esri Legend component successfully

but when I use QueryTask and return the geometry I assign a custom symbol. for eg
        private void QueryTask_ExecuteCompleted(object sender, ESRI.ArcGIS.Client.Tasks.QueryEventArgs args)
{
            FeatureSet featureSet = args.FeatureSet;

            if (featureSet != null && featureSet.Features.Count > 0)
            {
                Graphic selectedFeature = null;
                for (int i = 0; i < featureSet.Features.Count; i++)
                {
                    // Show selected feature attributes in DataGrid
                    selectedFeature = featureSet.Features;
                    selectedFeature.Symbol = ColorMarkerSymbol;
                    graphicsLayer.Graphics.Add(selectedFeature);
                }
            }
}


now how do I just use the default symbol to be shown on the map please help
also I have issues with Legend.LayerIDs it gives me a error when I give my featurelayer name

Please do help
0 Kudos
1 Reply
DominiqueBroux
Esri Frequent Contributor
also I have issues with Legend.LayerIDs it gives me a error when I give my featurelayer name

LayerIds error is a known issue. It's only happening during design time in Visual Studio. You can still run your application without problem.

I assign a custom symbol. for eg

The legend control doesn't take into account the symbols affected to individual graphics.
It's only taking care of the renderers.

In your case, instead of affecting the same symbol to all graphics, you could use a simplerenderer with this symbol.
You would get automatically  the corresponding item in the legend.
0 Kudos