wpf microsoft surface app — touch won't trigger

邮差的信 提交于 2019-12-10 23:57:07

问题


I'm building out my first touch application on a Microsoft Surface Pro 3 device, in Visual Studio 2010 with the Surface SDK 2.0, and I'm having trouble with touch events. Click events are firing just fine, but none of the touch, previewtouch, or manipulation events are firing.

I can't find any question posted online regarding such a simple issue with touch. In surface app code examples, I can't figure out what I'm doing differently. Any ideas?

Thanks

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
    }

来源:https://stackoverflow.com/questions/34487122/wpf-microsoft-surface-app-touch-wont-trigger

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!