【问题标题】:Disable zoom and move bing map in XAML在 XAML 中禁用缩放和移动 bing 地图
【发布时间】:2016-11-02 02:23:11
【问题描述】:

您好,我想使用 XAML 禁用移动和放大 bing 地图,这是我的代码:

<m:Map x:Name="myMap"
           ScaleVisibility="Hidden"
           CredentialsProvider="..." 
           Mode="AerialWithLabels"
           ZoomLevel="1.5"
           />

但是,如何阻止移动和缩放?

谢谢!

【问题讨论】:

  • 设置SupportedManipulations 属性。
  • 说“成员 SupportedManipulations 无法识别或无法访问”
  • 是的,我知道,但我不知道为什么无法识别 :(。我输入了 "xmlns:m="clr-namespace:Microsoft.Maps.MapControl.WPF;assembly=Microsoft.Maps. MapControl.WPF""
  • 完成了我把 SupportedManipulations="none" 但没有任何改变:(

标签: c# wpf xaml bing-maps bing


【解决方案1】:

您必须使用视图更改事件并覆盖中心/缩放值。例如:

var center = myMap.Center;
var zoom = myMap.ZoomLevel;

myMap.ViewChangeOnFrame += (s, e) =>
{
    if(myMap.ZoomLevel != zoom){
        myMap.ZoomLevel = zoom;
    }

    if (!myMap.Center.Equals(center))
    {
        myMap.Center = center;
    }
}; 

【讨论】:

    猜你喜欢
    • 2012-08-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-12-11
    • 1970-01-01
    • 2021-04-13
    • 1970-01-01
    • 2020-09-09
    相关资源
    最近更新 更多