Windows Phone 7 manipulationstarted event

Source: Internet
Author: User

System. windowsuielement. manipulationstarted event

It occurs when the input device starts operations on the uielement object.

The manipulationstarted event occurs after the manipulationstarting event. With manipulationstartedeventargs, you can perform the following operations.

Use the manipulationcontainer attribute to obtain the elements relative to the operation location.

Use the manipulationorigin attribute to obtain the operation origin.

Call the complete method to cancel the operation.

Example: Click the interface to trigger the event to randomly generate Hello World










<! -- Contentpanel-place additional content here -->
<Grid X: Name = "contentpanel" grid. Row = "1" margin = "12,0, 12,0">
<Textblock name = "txtblk"
TEXT = ""
Horizontalalignment = "center"
Verticalalignment = "center"/>
</GRID>
</GRID>

Event Processing

// Called when the manipulationstarted event occurs. It occurs when the input device starts operations on the uielement object.
Protected override void onmanipulationstarted (manipulationstartedeventargs ARGs)
{
Textblock newtextblock = new textblock ();
Newtextblock. Text = "Hello, world! ";
Newtextblock. horizontalalignment = horizontalalignment. Left; // leftmost level of the parent Element
Newtextblock. verticalalignment = verticalignment. Top; // The leftmost vertical parent Element
Newtextblock. Margin = New thickness (
(Contentpanel. actualwidth-txtblk. actualwidth) * Rand. nextdouble (),
(Contentpanel. actualheight-txtblk. actualheight) * Rand. nextdouble (),
0, 0 );
// The four double values of the thickness structure describe the four sides (left, top, right, and bottom) of the rectangle respectively ).
Contentpanel. Children. Add (newtextblock );

args. Complete (); // complete the operation
args. Handled = true; // obtain or set the route event to the handled value. If this parameter is set to true, most Programs In the event routing path can be prevented from processing the same event again.
base. onmanipulationstarted (ARGs); // you must call the onmanipulationstarted method of the basic class to receive the event.
}

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.