WP7 development accumulation

Source: Internet
Author: User

1. When compiling the item items in The ListBox In the intent, the leftbuttondown or leftbuttonup events are not very effective and are easily triggered when sliding.

Therefore, to handle a touch event, if it is not slide, it is equivalent to clicking.

 Private  Point  ?  Startpoint;
Private Void Stackpanel_manipulationstarted ( Object Sender, manipulationstartedeventargs E)
{
Startpoint = E. manipulationorigin;
Base . Onmanipulationstarted (E );
}

Private Void Stackpanel_manipulationdelta ( Object Sender, manipulationdeltaeventargs E)
{
If (Startpoint. hasvalue)
{
If (Math. Abs (E. deltamanipulation. Translation. X) > 0 | Math. Abs (E. deltamanipulation. Translation. Y) > 0 )
{
This . Startpoint = Null ;
}
}
Base . Onmanipulationdelta (E );
}

Private Void Stackpanel_manipulationcompleted ( Object Sender, manipulationcompletedeventargs E)
{
If (Startpoint. hasvalue)
{
If (Math. Abs (E. totalmanipulation. Translation. X) = 0 && Math. Abs (E. totalmanipulation. Translation. Y) = 0 )
{
Frameworkelement touchedcontrol;
// Determine the control you click to make different judgments.
 
If(E. originalsourceIsTextblock)
{

}
Else If(E. originalsourceIsImage)
{

}
}
}
Base. Onmanipulationcompleted (E );
}

However, the problem above is that the specific control occupies a small proportion, so debugging on the device will find it difficult to click to enter, one trick here is to change its parent container, such as grid and stackpanel, to transparent!

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.