在Windows Phone 7中,当用户按下屏幕上的任何位置时,如何使事件加速

时间:2011-08-10 10:54:18

标签: silverlight windows-phone-7

我是使用silverlight的Windows Phone 7新手。 我希望用户能够按下屏幕上的任何地方,它会引发一个事件,我将能够知道用户按下屏幕的位置。

请帮帮我。

2 个答案:

答案 0 :(得分:2)

您可能无法将点击事件添加到网页的主标记,但您可以在页面标记中使用MouseLeftButtonUp

答案 1 :(得分:2)

尝试使用Silverlight toolkit for Windows Phone 7。 如果您需要在页面上捕获Tap事件,则必须使用GestureListner类的服务。

<phone:PhoneApplicationPage 
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    x:Name="phoneApplicationPage" 
    x:Class="XXXXX"
    >
       <toolkit:GestureService.GestureListener>
                <toolkit:GestureListener Tap="Page_Tap" />
       </toolkit:GestureService.GestureListener>
        .
        .
        .