1 PrivatePopup p;2 Private voidButton_Click (Objectsender, RoutedEventArgs e)3 {4p=NewPopup ();5Dengludemo dl=NewDengludemo ();6Dl. Width =1366;7Dl. Height =260;8Dl. Margin =NewThickness (0, $,0,0);9 //if (P! = NULL | | p.isopen = = TRUE)Ten //{ One //return; A //} -Messagedialog MD =NewMessagedialog ("whether to exit login"); -MD.COMMANDS.ADD (NewUicommand ("Determine", (a) = = the { - -},0)); -MD.COMMANDS.ADD (NewUicommand ("Cancel", (a) = = + { - +},1)); AMd. Defaultcommandindex =0; atMd. Cancelcommandindex =1; - varcmd =Md. Showasync (); -Dl.eh = (A, b) = = - { -P.child =DL; -P.isopen =true; in }; -P.child =DL; toP.isopen =true; + - } the}
1 <UserControl2 x:class= "Vs2013win8._1.dengludemo"3 xmlns= "Http://schemas.microsoft.com/winfx/2006/xaml/presentation"4 xmlns:x= "Http://schemas.microsoft.com/winfx/2006/xaml"5 xmlns:local= "Using:vs2013win8._1"6 xmlns:d= "http://schemas.microsoft.com/expression/blend/2008"7 XMLNS:MC= "http://schemas.openxmlformats.org/markup-compatibility/2006"8 mc:ignorable= "D"9 D:designheight= "260"Ten D:designwidth= "1360"> One A <Grid> - <Grid.background> - <SolidColorBrushColor= "Black"Opacity= "0.7"></SolidColorBrush> the </Grid.background> - <StackPanelBackground= "Lightseagreen"Orientation= "Vertical" > - - <StackPanelOrientation= "Horizontal"Margin= "428,40,0,0"> + <TextBlockText= "User name:"FontSize= "+"Width= "a"></TextBlock> - <TextBoxx:name= "Txt_name"Width= "273"Margin= "20,0,0,0"></TextBox> + </StackPanel> A at <StackPanelOrientation= "Horizontal"Margin= "428,40,0,0"> - <TextBlockText= "Password:"FontSize= "+"Width= "a"></TextBlock> - <PasswordBoxx:name= "Txt_password"Width= "273"Margin= "20,0,0,0"></PasswordBox> - </StackPanel> - - <StackPanelOrientation= "Horizontal"Margin= "428,30,0,0"> in <HyperlinkbuttonTapped= "Button_tapped_3"FontSize= "+"Foreground= "White">No account click to register</Hyperlinkbutton> - <ButtonTapped= "Button_tapped_1"Content= "Login"FontSize= " the"Foreground= "White"Background= "Lightseagreen"Width= "Max"Height= "$"Margin= "180,0,0,0"/> to <ButtonTapped= "Button_tapped_2"Content= "Cancel"FontSize= " the"Foreground= "White"Background= "Lightseagreen"Width= "153"Height= "$"Margin= "20,0,0,0"/> + </StackPanel> - </StackPanel> the </Grid> * </UserControl>
1 PublicEventHandler eh;2 Private voidButton_tapped_1 (Objectsender, Tappedroutedeventargs e)3 {4 if(Eh! =NULL)5 {6Eh This,NULL);7 }8}