WP7 captures the slide direction of the screen (up or down)

Source: Internet
Author: User

Previously, touch was used. framereported is used to perform touch screen operations, but later it was found that some meticulous things could not be implemented. For example, the touchpoint action can only determine whether to click, move, and leave, so the sliding up or down is a solution.

After self-exploration, manipulationdelta is used to implement this function.

CodeAs follows:

 

Double firsty = 0.0; protected override void onmanipulationdelta (manipulationdeltaeventargs e) {If (firsty = 0.0) {firsty = E. cumulativemanipulation. translation. y;} else {double result = E. cumulativemanipulation. translation. y-firsty; If (result> 0) {This. dispatcher. begininvoke () => {MessageBox. show ("Move Down") ;}) ;}else if (result <0) {This. dispatcher. begininvoke () => {MessageBox. show ("Move Up") ;}) ;}firsty = 0.0 ;}base. onmanipulationdelta (E );}

 

[As follows]

 

In addition, the younger brother has also created a WP7 technology exchange group. If you are interested, you can join us and learn and make progress together !~

QQ: 170716593

 

 

 

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.