Legend IsInScaleRange vs Layer MaximumScale

Discussion created by afcon on Feb 11, 2014

I have 2 questions...

1. I have a legend which declared with checkboxes for layers visibility (see XAML).
and i have a function which zoom to maximumScale of a given FeatureLayer. (see code below)
When i call the function it zoom to the maximum featureLayer scale and i see on map its graphics (it is still visible and did not
disappeared), but the legend checkbox is not enabled (guessing the IsInScaleRange property returns false)
what am i missing (if i see it on map it should also be enabled on legend - right)?

2. Is it possible to register an event or some other way of handling when a checkbox is checked on a layerItem
in order to reverse the check action on a specific layerItem?


[HTML]<esri:Legend Map="{Binding ElementName=_map}" Name="_Legend"
                                <CheckBox Content="{Binding Label}"
                            IsChecked="{Binding IsEnabled, Mode=TwoWay}"
                            IsEnabled="{Binding IsInScaleRange}" >


 internal void ZoomTo(FeatureLayer layer)
            if (layer != null)
                double resolution = _map.MinimumResolution;

                if (layer.LayerInfo.MaximumScale != 0)
                    double scaleTo = Math.Round(layer.LayerInfo.MaximumScale * _map.ZoomFactor);
                    double calcResolution = (_map.Resolution / _map.Scale) * scaleTo;

                    MapPoint myMapPoint = _map.Extent.GetCenter();

                    double xMin = myMapPoint.X - (_map.ActualWidth * calcResolution * (1 / _map.ZoomFactor));
                    double yMin = myMapPoint.Y - (_map.ActualHeight * calcResolution * (1 / _map.ZoomFactor));

                    double xMax = myMapPoint.X + (_map.ActualWidth * calcResolution * (1 / _map.ZoomFactor));
                    double yMax = myMapPoint.Y + (_map.ActualHeight * calcResolution * (1 / _map.ZoomFactor));

                    ESRI.ArcGIS.Client.Geometry.Envelope myEnvelope = new ESRI.ArcGIS.Client.Geometry.Envelope(xMin, yMin, xMax, yMax);
                    _map.ZoomToResolution(resolution, _map.Extent.GetCenter());