禁用Windows Phone 8地图控制中的标签
本文关键字:标签 控制 地图 Windows Phone 禁用 | 更新日期: 2023-09-27 18:14:26
是否有办法禁用在Microsoft.Phone.Maps.Controls.Map控件上显示的地名、道路名称等?
我在Bing基本地图的上方显示了一个自定义tile资源,但是标签仍然显示在自定义tile资源的上方。
理想情况下,我想把必应的基础地图关闭,并用我自己的地图代替它,但我的印象是,这是不可能与这个控制。所以我使用了次优方法。
提前感谢任何想法!
尽管它被标记为贬值,我还是选择了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;
}