示例#1
0
        public MessageBoxWithPasswordBox(string message, string title, string password, params string[] buttons) : base(title, buttons)
        {
            StackPanel sp = new StackPanel();

            if (message != null)
            {
                sp.Children.Add(MessageGenerator.Generate(message));
            }

            PasswordBox = new PasswordBox()
            {
                Password   = (password == null) ? "" : password,
                Margin     = new Windows.UI.Xaml.Thickness(0, -18, 0, 24),
                Background = new SolidColorBrush(Color.FromArgb(255, 204, 204, 204))
            };

            sp.Children.Add(PasswordBox);

            //focus on the text box
            PasswordBox.Loaded += delegate { PasswordBox.Focus(Windows.UI.Xaml.FocusState.Programmatic); };

            PasswordBox.KeyUp += TextBox_KeyUp;

            Content = sp;
        }
 public CustomMessageBox(string message, string title, params string[] buttons) : base(null, title, buttons)
 {
     if (message != null)
     {
         Content = MessageGenerator.Generate(message);
     }
 }