【问题标题】:C# Wpf surfaceusercontrol Contact Events not firingC# Wpf surfaceusercontrol 联系人事件未触发
【发布时间】:2013-05-02 09:56:13
【问题描述】:
我有一个SurfaceWindow。其中有一个Scatterview 和一个ScatterViewItem,在Scatterviewitem 中是一个包含SurfaceUserControl 的视图框。我在控件中添加了一些ContactEvents,例如ContactDown、Contactup、ContactTapGesture 等(以及事件的预览版)。
触发的唯一事件是contactdown 和 leave。在Scatterviewitem 上,其他事件也有效。
有人知道为什么吗?
抱歉,我无法向您显示任何代码。我在工作,由于某种原因代理阻止了登录到该站点。我正在用手机写这篇文章。
【问题讨论】:
标签:
c#
wpf
user-controls
contact
pixelsense
【解决方案1】:
<s:SurfaceWindow x:Class="WeltkarteSurface.SurfaceWindow1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:s="http://schemas.microsoft.com/surface/2008"
xmlns:uc="clr-namespace:WeltkarteSurface"
Title="WeltkarteSurface" mc:Ignorable="d" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" Height="768" Width="1024" SizeToContent="Manual" Loaded="SurfaceWindow_Loaded" >
<s:SurfaceWindow.Resources>
</s:SurfaceWindow.Resources>
<Grid>
<s:ScatterView x:Name="MainScatterView" Background="#FFB4DCFC">
<s:ScatterViewItem x:Name="MainScatterViewItem" MinWidth="1024" MinHeight="768" Center="512,384" CanRotate="False" Width="1024" Height="768" Background="Transparent" ScatterManipulationDelta="MainScatterViewItem_ScatterManipulationDelta" >
<s:ScatterViewItem.Template>
<ControlTemplate>
<Viewbox x:Name="MainViewbox">
<uc:MainMap PreviewContactTapGesture="MainMap_PreviewContactTapGesture" ContactTapGesture="MainMap_ContactTapGesture"></uc:MainMap>
</Viewbox>
</ControlTemplate>
</s:ScatterViewItem.Template>
</s:ScatterViewItem>
</s:ScatterView>
</Grid>
</s:SurfaceWindow>
这是我的 Surfacewindow 代码。 MainMap 上的 PreviewContactTapGesture 和 ContactTapGesture 事件仅在它们不在 Scatterviewitem 中时才起作用。
谢谢