在Windows Phone 8地图控件中禁用标签 [英] Disabling labels in Windows Phone 8 Map Control

查看:51
本文介绍了在Windows Phone 8地图控件中禁用标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有什么方法可以禁止地名,道路名称等显示在Microsoft.Phone.Maps.Controls.Map控件上?

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

我在Bing底图的顶部显示了一个自定义的TileSource,但是标签仍在自定义图块源的顶部显示.

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.

理想情况下,我想关闭Bing底图,并用自己的底图替换,但给人的印象是此控件无法实现.因此,我使用的是下一个最佳方法.

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.

提前感谢任何想法!

推荐答案

即使已将其标记为已折旧,我还是使用WP7 Microsoft.Phone.Controls.Maps.Map,因为它具有我所需要的功能.我已经将控件和功能封装在UserControl中,因此一旦新的Microsoft.Phone.Maps.Controls.Map控件明智地使用了功能,就可以轻松换出.

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

这篇关于在Windows Phone 8地图控件中禁用标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆