我正在开发一个Windows Phone 7.5应用程序,我在其中映射了许多标记 .

我的代码在OnNavigatedTo中运行,类似于以下内容:

if (points != null && points.Any())
{
    var markers = new List<GeoCoordinate>();
    foreach (var point in points)
    {
        TextBlock textBlock = new TextBlock();
        textBlock.Text = "...";
        textBlock.TextWrapping = TextWrapping.Wrap;
        stackPanel1.Children.Add(textBlock);

        Pushpin pin = new Pushpin();
        pin.Location = new GeoCoordinate(point.Latitude, point.Longitude);
        markers.Add(pin.Location);
        pin.Content = point.Sequence.ToString();
        mapItems.Items.Add(pin);
    }

    //map1.ZoomLevel = 15; // Tried this as well

    map1.SetView(LocationRect.CreateLocationRect(markers));
    markers.Clear();

    points = null;
}

不幸的是,尽管在实际控件上设置了初始缩放级别15,但SetView正在缩小所需数量以适应 Map 中的所有引脚 . 但是,如果手机关闭,或者我手动将其关闭,然后重新打开,则恢复后 Map 会以完美的数量放大 .

在调用SetView后,是否缺少正确刷新 Map 缩放级别的步骤?

我已经尝试用this answer中的代码替换我的SetView到WP7 Bing Maps Zoom level based on Push Pin collection locations,但它也要求's not working as I' .

控制(Lat和Long设置为实际值,这是区域标记的中心将被添加到):

<my:Map Height="311" HorizontalAlignment="Left" Margin="10,10,0,0" Name="map1" VerticalAlignment="Top" Width="440" CredentialsProvider="..." ZoomLevel="15">
    <my:Map.Center>
        <my1:GeoCoordinate Altitude="NaN" Course="NaN" HorizontalAccuracy="NaN" Latitude="0" Longitude="0" Speed="NaN" VerticalAccuracy="NaN" />
    </my:Map.Center>
    <my:MapItemsControl Name="mapItems" />
</my:Map>

谢谢!