我正在开发一个Windows 10 UWP应用程序。该应用程序有一个MapControl:
<Maps:MapControl x:Name="map" />
我添加了UserControl XAML控件UserMapIcon.xaml
的多个实例:
<UserControl
x:Class="Taq.Views.UserMapIcon"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Taq.Views"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
d:DesignHeight="20"
d:DesignWidth="20">
<Grid>
<Ellipse Width="10" Height="10" Fill="Black"></Ellipse>
</Grid>
</UserControl>
通过C#代码映射:
// ...
var umi = new UserMapIcon();
map.Children.Add(umi);
// ...
出于某些目的多次。所以,你可以想象有一个包含许多圆圈的地图。
问题是:我的应用程序在我的触摸屏平板电脑上运行,我想通过两个手指捏缩放地图。但是,如果我的一个手指触摸UserControl而另一个手指触摸地图,则捏缩放变为平移手势。如何解决这个问题?
答案 0 :(得分:0)
通过我的实验,设置UserControl的IsHitTestVisible =&#34; False&#34;解决了这个问题。
<UserControl
x:Class="Taq.Views.UserMapIcon"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Taq.Views"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
d:DesignHeight="20"
d:DesignWidth="20"
IsHitTestVisible="False">
<Grid>
<Ellipse Width="10" Height="10" Fill="Black"></Ellipse>
</Grid>
</UserControl>