Hi, I have created a FeatureLayer to show the road surface type I am adding the layer using the where clause to the map.. the map has been added successfully..but I also have to show the Legend symbol of the queried result and not the whole Legend <esri:Legend Map="{Binding ElementName=map}" Margin="0,0,80,0"
LayerItemsMode="Tree" HorizontalAlignment="Right"
ShowOnlyVisibleLayers="True" x:Name="CustomLegend"
/>
FeatureLayer MyFeatureLayer2 = new FeatureLayer();
MyFeatureLayer2.Url = "http://192.168.1.52/ArcGIS/rest/services/LRS_CW_SURFACE_TYPE/MapServer/0";
MyFeatureLayer2.Where = "SURFACING_TYPE = 7";
MyFeatureLayer2.OutFields.AddRange(new string[] { "SURFACING_TYPE" });
MyFeatureLayer2.ID = "RoadSurfaceType";
MyFeatureLayer2.ID = "MyFeatureLayer2";
mainPage.map.Layers.Add(MyFeatureLayer2);
mainPage.map.ZoomTo(MyFeatureLayer2.Geometry);
String[] aerialList = { "RoadSurfaceType" };
mainPage.CustomLegend.LayerIDs = aerialList;
mainPage.CustomLegend.LayerItemsMode = ESRI.ArcGIS.Client.Toolkit.Legend.Mode.Flat;
mainPage.CustomLegend.Visibility = System.Windows.Visibility.Visible;
mainPage.CustomLegend.Refresh();
but the full legend is still visible please help me on this