private void Legend_Refreshed(object sender, Legend.RefreshedEventArgs e) { if (e.LayerItem.Layer is ESRI.ArcGIS.Client.GraphicsLayer) MyLegend.LayerItems.Remove(e.LayerItem); }You can obviously extend this sample by using another criteria than the layer type : for example a custom attached property.
Is there a way to remove the Bing basemap from the Legend? I tried using the same code as the GraphicsLayer, but it just doesn't see it.
<esri:Legend x:Name="MyLegend" Map="{Binding ElementName=MyMap}" Height="400" Width="400" Refreshed="Legend_Refreshed" >
private void Legend_Refreshed(object sender, Client.Toolkit.Legend.RefreshedEventArgs e) { foreach (var bingLayerItem in MyLegend.LayerItems.Where(item => item.Layer is TileLayer).ToList()) MyLegend.LayerItems.Remove(bingLayerItem); }