帮助密码箱输入 [英] help passwordbox enter

查看:94
本文介绍了帮助密码箱输入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都可以解释为什么当我调试这个并按密码框输入时我没有收到任何消息框而我错过了什么?



can anyone explain as to why when i debug this and press enter with the passwordbox i dont get any messagebox and i missing something?

using System;
using System.Windows;
using System.Windows.Input;
using System.Windows.Threading;

namespace CodeTesting
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
            DispatcherTimer CurrentTimeTimer = new DispatcherTimer();
            CurrentTimeTimer.Interval = TimeSpan.FromSeconds(0.1);
            CurrentTimeTimer.Tick += CurrentTimeTimer_Tick;
            CurrentTimeTimer.Start();
        }
        public void CurrentTimeTimer_Tick(object sender, EventArgs e)
        {
            DateTimeLabel.Content = DateTime.Now.ToString("hh:mm:ss tt");
        }
        private void PasswordInput_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Enter) 
            {
                MessageBox.Show("vaildating");
            }
        }
    }
}

推荐答案

根据文档 [ ^ ], KeyEventArgs 不包含名为 Key 的属性。
According to the documentation[^], KeyEventArgs does not contain a property named Key.


这篇关于帮助密码箱输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆