开发者

In windows phone 7, How to make an event raise when user presses anywhere on the screen

I am new to windows phone 7 using silverlight. I want that the u开发者_运维问答ser will be able to press anywhere on the screen, it will raise an event, and I will be able to know where on the screen the user pressed.

Help me please.


you might not be able to add a click event to the main tag of a page but you can use MouseLeftButtonUp in the page tag.


Try by using the Silverlight toolkit for Windows Phone 7. If you need to capture the Tap event on the page, you've to use the services of the GestureListner class.

<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>
        .
        .
        .
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜