首页 > 代码库 > windows 8.1 MessageDialog
windows 8.1 MessageDialog
1 private Popup p; 2 private void Button_Click(object sender, RoutedEventArgs e) 3 { 4 p=new Popup(); 5 DengluDemo dl=new DengluDemo(); 6 dl.Width = 1366; 7 dl.Height = 260; 8 dl.Margin = new Thickness(0, 200, 0, 0); 9 //if (p != null || p.IsOpen == true) 10 //{ 11 // return; 12 //} 13 MessageDialog md = new MessageDialog("是否退出登陆"); 14 md.Commands.Add(new UICommand("确定", (a) => 15 { 16 17 }, 0)); 18 md.Commands.Add(new UICommand("取消", (a) => 19 { 20 21 }, 1)); 22 md.DefaultCommandIndex = 0; 23 md.CancelCommandIndex = 1; 24 var cmd = md.ShowAsync(); 25 dl.eh = (a, b) => 26 { 27 p.Child = dl; 28 p.IsOpen = true; 29 }; 30 p.Child = dl; 31 p.IsOpen = true; 32 33 } 34 }
1 <UserControl 2 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" 10 d:DesignWidth="1360"> 11 12 <Grid> 13 <Grid.Background> 14 <SolidColorBrush Color="Black" Opacity="0.7"></SolidColorBrush> 15 </Grid.Background> 16 <StackPanel Background="LightSeaGreen" Orientation="Vertical" > 17 18 <StackPanel Orientation="Horizontal" Margin="428,40,0,0"> 19 <TextBlock Text="用户名:" FontSize="25" Width="80"></TextBlock> 20 <TextBox x:Name="txt_Name" Width="273" Margin="20,0,0,0"></TextBox> 21 </StackPanel> 22 23 <StackPanel Orientation="Horizontal" Margin="428,40,0,0"> 24 <TextBlock Text="密 码:" FontSize="25" Width="80"></TextBlock> 25 <PasswordBox x:Name="txt_Password" Width="273" Margin="20,0,0,0"></PasswordBox> 26 </StackPanel> 27 28 <StackPanel Orientation="Horizontal" Margin="428,30,0,0"> 29 <HyperlinkButton Tapped="Button_Tapped_3" FontSize="18" Foreground="White">还没有账号 点击去注册</HyperlinkButton> 30 <Button Tapped="Button_Tapped_1" Content="登录" FontSize="20" Foreground="White" Background="LightSeaGreen" Width="150" Height="49" Margin="180,0,0,0"/> 31 <Button Tapped="Button_Tapped_2" Content="取消" FontSize="20" Foreground="White" Background="LightSeaGreen" Width="153" Height="49" Margin="20,0,0,0"/> 32 </StackPanel> 33 </StackPanel> 34 </Grid> 35 </UserControl>
1 public EventHandler eh; 2 private void Button_Tapped_1(object sender, TappedRoutedEventArgs e) 3 { 4 if (eh != null) 5 { 6 eh(this,null); 7 } 8 }
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。