[Bug] Scale not updated when zooming to an object outside of the visible extent

Discussion created by bsundsbo on May 7, 2014
Latest reply on Sep 12, 2014 by bsundsbo

I have discovered a minor bug where the Scale property does not update (PropertyChanged) when using the ZoomTo(Geometry) method. The object I am zooming to must be outside the visible extent for this to occur. I am using Runtime SDK 10.2.2. The scale only recovers after zooming in or out. Panning does not update the Scale property

Here is some code to reproduce. The map itself is not included. For the logic to work, the map must be in UTM (or some other reference system that represents a coordinate in meters). Or the logic around the extent to zoom to must be changed.

<Button DockPanel.Dock="Left" Padding="8" Content="Zoom to" Click="Button_Click"/>

<TextBlock HorizontalAlignment="Center" VerticalAlignment="Bottom" Margin="20" Text="{Binding Path=Scale, StringFormat='{}{0:n}', ElementName=PART_Map}" FontSize="16" />

private void Button_Click(object sender, RoutedEventArgs e)
    var random = new Random();
    Point point = new Point(random.Next(0, (int) PART_Map.ActualWidth), random.Next(0, (int) PART_Map.ActualHeight));
    point.X -= 10000;
    point.Y -= 10000;
    var mapPoint = PART_Map.ScreenToMap(point);
    var extent = new Envelope(mapPoint, new MapPoint { X = mapPoint.X + 1000, Y = mapPoint.Y + 1000});

Zoom the map all the way in, and click the button. This should calculate a random envelope a bit outside of the visible extent. The scale does not update. Zoom either in or out and see the scale does not reflect the actual scale. Zooming to a point inside the visible extent does update the scale

As a side note, is there somewhere else I should post any bugs I find, rather than the forums?