In a control in Windows 8, there are righttapped events for input controls such as contextmenuopening events and button, such as TextBox, that are not input controls.
This article will narrator the use of two events. Of these two events
PopupMenu is the specific class of the right-click pop-up menu.
First we look at the instantiation of the specific menu class and get the project code
<summary>///Set Right click on specific processing details///</summary>///<param name= "Sender" ></p aram> public async void Setrightclick (object sender) {//Add menus popupmenu menu =
New PopupMenu ();
MENU.COMMANDS.ADD (New Uicommand ("copy 0", NULL, 0));
MENU.COMMANDS.ADD (New Uicommand ("Cut 1", NULL, 1);
MENU.COMMANDS.ADD (New Uicommand ("Paste 2", NULL, 2));
MENU.COMMANDS.ADD (New Uicommandseparator ());
MENU.COMMANDS.ADD (New Uicommand ("full screen", NULL, 3);
MENU.COMMANDS.ADD (New Uicommand ("Snap screen", NULL, 4)); Gets the selected menu item var cmd = await menus.
Showforselectionasync (getrectposition (FrameworkElement) sender)); if (cmd!= null) {switch (int) cmd. ID) {Case 0:tbtext.text = "Selected (" + cmd). Label + "), whose ID is" + cmd. "
Id; Break; Case 1:tbtext.text = "Selected (" + cmd). Label + "), whose ID is" + cmd. "
Id;
Break Case 2:tbtext.text = "Selected (" + cmd). Label + "), whose ID is" + cmd. "
Id;
Break Case 3:tbtext.text = "Selected (" + cmd). Label + "), whose ID is" + cmd. "
Id;
Break Case 4:tbtext.text = "Selected (" + cmd). Label + "), whose ID is" + cmd. "
Id;
Break
} else {tbtext.text = "context menu"; }//Get menu location Rect getrectposition (frameworkelement element) {Generaltransform Btnform = element.
Transformtovisual (NULL); Point point = Btnform.
Transformpoint (new Point ()); Return to New Rect (Point, New Size (Element). ActualWidth, Element.
ActualHeight)); }