WPF全局禁用tab键选中控件
在主窗体添加键盘点击事件
private void Window_PreviewKeyDown(object sender, KeyEventArgs e) { Key key = (e.Key == Key.System ? e.SystemKey : e.Key); if (key == Key.Tab) { e.Handled = true; } }
编程是个人爱好
在主窗体添加键盘点击事件
private void Window_PreviewKeyDown(object sender, KeyEventArgs e) { Key key = (e.Key == Key.System ? e.SystemKey : e.Key); if (key == Key.Tab) { e.Handled = true; } }