在Windows Phone 8 Map Control中禁用标签

时间:2013-05-21 06:51:54

标签: c# xaml maps windows-phone-8

有没有办法禁用在Microsoft.Phone.Maps.Controls.Map控件上显示的地名,道路名称等?

我在Bing底图的顶部显示了一个自定义TileSource,但标签仍然显示在自定义磁贴源的顶部。

理想情况下,我想关闭Bing基础地图并将其替换为我自己的地图,但我认为这种控制无法实现。所以我正在使用下一个最好的方法。

提前感谢任何想法!

1 个答案:

答案 0 :(得分:0)

即使它被标记为折旧,我已经使用了WP7 Microsoft.Phone.Controls.Maps.Map,因为它具有我需要的功能。我已经将控件和功能封装在UserControl中,因此一旦新的Microsoft.Phone.Maps.Controls.Map控件捕获了功能,就很容易换出。

/// <summary>
/// Sets TileSource as the exclusive MapTileLayer
/// </summary>
private void RefreshTileSource()
{
    for (var i = Map.Children.Count - 1; i >= 0; i--)
    {
        MapTileLayer tileLayer = Map.Children[i] as MapTileLayer;
        if (tileLayer != null)
        {
            Map.Children.RemoveAt(i);
        }
    }

    // Tiles
    MapTileLayer layer = new MapTileLayer();
    layer.TileSources.Add(ViewModel.TileSource);
    Map.Children.Add(layer);

    // Constrain map to area with custom tiles
    MapMode mode = new MapMode();
    mode.SetZoomRange(ViewModel.TileSource.ZoomRange);
    if (ViewModel.MapBounds.North > ViewModel.MapBounds.South)
        mode.LatitudeRange = new Range<double>(ViewModel.MapBounds.South, ViewModel.MapBounds.North);
    else
        mode.LatitudeRange = new Range<double>(ViewModel.MapBounds.North, ViewModel.MapBounds.South);
    if (ViewModel.MapBounds.West > ViewModel.MapBounds.East)
        mode.LongitudeRange = new Range<double>(ViewModel.MapBounds.East, ViewModel.MapBounds.West);
    else
        mode.LongitudeRange = new Range<double>(ViewModel.MapBounds.West, ViewModel.MapBounds.East);
    Map.Mode = mode;
}