wpf microsoft surface app - 触摸不会触发

时间:2015-12-28 02:49:16

标签: c# wpf xaml touch touch-event

我正在使用Surface SDK 2.0在Visual Studio 2010中的Microsoft Surface Pro 3设备上构建我的第一个触摸应用程序,而我遇到了触摸事件的问题。点击事件正好点火,但触摸,预览触摸或操纵事件都没有触发。

我无法在网上找到有关触摸此类简单问题的任何问题。在表面应用程序代码示例中,我无法弄清楚我在做什么不同。有什么想法吗?

由于

XAML:

<s:SurfaceWindow x:Class="SurfaceProject.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"
Title="SurfaceProject"
xmlns:l="clr-namespace:SurfaceApplication1"
mc:Ignorable="d" 
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"           
xmlns:ed="http://schemas.microsoft.com/expression/2010/drawing" 
xmlns:Microsoft_Surface_Presentation_Generic="clr-namespace:Microsoft.Surface.Presentation.Generic;assembly=Microsoft.Surface.Presentation.Generic" 
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" 
xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions" 
xmlns:tve="clr-namespace:SurfaceProject"                              
d:DesignHeight="750" d:DesignWidth="2000" WindowState="Maximized"

>
    <s:SurfaceButton 
        x:Name="SurfaceButtonTest" 
        Content="SurfaceButtonTest" 
        Grid.Column="4" 
        Margin="0" 
        Grid.Row="5" 
        TouchDown="SurfaceButtonTest_TouchDown" 
        Click="SurfaceButtonTest_Click" />
</Grid>

C#:

  using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  using System.Windows;
  using System.Windows.Controls;
  using System.Windows.Data;
  using System.Windows.Documents;
  using System.Windows.Input;
  using System.Windows.Media;
  using System.Windows.Media.Imaging;
  using System.Windows.Navigation;
  using System.Windows.Shapes;
  using Microsoft.Surface;
  using Microsoft.Surface.Presentation;
  using Microsoft.Surface.Presentation.Controls;
  using Microsoft.Surface.Presentation.Input;

//

    private void SurfaceButtonTest_Click(object sender, RoutedEventArgs e)
    {
        SurfaceButtonTest.Content = "Click Received";
        //test
    }
    private void SurfaceButtonTest_TouchDown(object sender, TouchEventArgs e)
    {
        SurfaceButtonTest.Content = "Touch Received";
        //test
    }

0 个答案:

没有答案