Disabling labels in Windows Phone 8 Map Control

纵然是瞬间 提交于 2019-12-12 02:55:55

问题


Is there any way to disable place names, road names, etc. from showing on the Microsoft.Phone.Maps.Controls.Map control?

I'm showing a custom TileSource over the top of the Bing basemap but the labels are still showing through on top of the custom tile source.

Ideally I'd like to turn the Bing base map off and replace it with my own but am under the impression that's not possible with this control. So I'm using the next best approach.

Thanks in advance for any ideas!


回答1:


Even though it's marked as depreciated, I've gone with the WP7 Microsoft.Phone.Controls.Maps.Map as it has the functionality I require. I've encapsulated the control and functionality within a UserControl so it's easy to swap out once the new Microsoft.Phone.Maps.Controls.Map control has caught up functionality wise.

/// <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;
}


来源:https://stackoverflow.com/questions/16663817/disabling-labels-in-windows-phone-8-map-control

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!