Solved! Go to Solution.
Thanks for the replies.
I tried changing that property but unfortunately it does not help me.If the layer is removed from the Legend, it was not getting added back when it was again made visible.
Also, I noticed that the LayerItemViewModel class returns strange values for certain properties.e.g. If the layer is out of visible scale range, it should return false for the property IsInScaleRange.But every time, it returns true.Same is the case for IsVisible and IsMapLayer.
Hello,
I am following this sample to create legend.
My requirement is to remove the layer from the legend when it is turned off due to scale dependant visibility and add it back to the legend when it is turned on.This layer could be feature layer or any sub layer from the map service.I guess, I have to call Legend::Refresh in the Map's extent changed event.
However,I am not being able to figure-out how to do this.To be frank,I am having hard time to understand the LayerItemViewModel class.
So can anybody help me on this issue?I would appreciate it.
I have attached screen shot of my Legend control with map.
Thanks.
<esri:Legend Map="{Binding ElementName=MyMap}"
LayerIDs="Points of Interest, United States"
LayerItemsMode="Tree"
ShowOnlyVisibleLayers="True"
Refreshed="Legend_Refreshed">
Thanks for the replies.
I tried changing that property but unfortunately it does not help me.If the layer is removed from the Legend, it was not getting added back when it was again made visible.
Also, I noticed that the LayerItemViewModel class returns strange values for certain properties.e.g. If the layer is out of visible scale range, it should return false for the property IsInScaleRange.But every time, it returns true.Same is the case for IsVisible and IsMapLayer.
But still, I can't use 'ShowOnlyVisibleLayers' property since I have to provide Check box before layer name.If user turns off the layer using this check box,then layer would not get re-added to Legend.Am i right?