Different Windows Phone (25)

Source: Internet
Author: User
Tags touch xmlns silverlight

Input (input) to capture the UIElement of the touch operation, Silverlight mode capture gesture operation, XNA way to capture gesture operation, multi-touch

Introduced

Unique device for Windows Phone 7.5 (SDK 7.1)

Capturing touch operations outside of UIElement

Silverlight method captures gesture operations

XNA Way to capture gesture operations

Multi-point touch control

Example

1. Demonstrates how to capture a touch operation other than UIElement

Outsidecapture.xaml

<phone:phoneapplicationpage x:class= "Demo.Input.Touch.OutsideCapture" xmlns= "Http://schemas.microsoft.com/wi Nfx/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 "fontfamily=" {StaticResource PhoneFontFamilyNormal} "FontSiz E= ' {StaticResource phonefontsizenormal} ' foreground= ' {StaticResource Phoneforegroundbrush} ' SupportedOrientations= "Portrait" orientation= "Portrait" mc:ignorable= "D" d:designheight= "768" d:designwidth= "The Shell:SystemTray.IsVis" ible= "True" > <grid x:name= "layoutroot" background= "Transparent" > <rectangle Name
             = "Rect" width= "height=" fill= "Red"      Mouseleftbuttondown= "Rect_mouseleftbuttondown" mouseleftbuttonup= "Rect_mouseleftbuttonup" Mousemove= "Rect_mousemove"/> <textblock name= "lblmsg" verticalalignment= "Top" textwrapping = "Wrap" text= "touch the Red Square with your finger, then remove your finger from the Red Square area"/> </Grid> </phone:PhoneApplicationPage>

OutsideCapture.xaml.cs

* * Demonstrates how to respond to the touch event on UIElement * * uielement-ui element * CaptureMouse ()-Captures external touch events outside the UIElement, so that even if the touch event is in the Uielem ENT can also respond to * releasemousecapture ()-Cancel the capture of external touch events * NOTE: * The CaptureMouse () method to invoke UIElement requires the following conditions * 1 
, there is currently no UIElement in the capture * 2, the CaptureMouse () method must be invoked in the MouseLeftButtonDown event of UIElement * * using System; 
Using System.Collections.Generic; 
Using System.Linq; 
Using System.Net; 
Using System.Windows; 
Using System.Windows.Controls; 
Using System.Windows.Documents; 
Using System.Windows.Input; 
Using System.Windows.Media; 
Using System.Windows.Media.Animation; 
Using System.Windows.Shapes; 
   
Using Microsoft.Phone.Controls; namespace Demo.Input.Touch {public partial class Outsidecapture:phoneapplicationpage {public Outsi 
        Decapture () {InitializeComponent (); } private void Rect_mouseleftbuttondown (object sender, MouseButtonEventArgs e) {rect.c AptuRemouse (); Lblmsg.text = "Touch point coordinates are:" + e.getposition (layoutroot). 
        ToString (); } private void Rect_mouseleftbuttonup (object sender, MouseButtonEventArgs e) {rect. 
        Releasemousecapture (); The private void Rect_mousemove (object sender, MouseEventArgs e) {//called Rect. After CaptureMouse (), even if the touch is removed Rect can respond to a touch event Lblmsg.text = "Touch Point coordinates:" + e.getposition (layoutroot). 
        ToString (); } 
    } 
}

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.