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