Get lowercase with keydown wpf

前端 未结 5 2061
再見小時候
再見小時候 2020-12-20 17:36

I want to get the keys pressed on the keyboard either with or without caplock:

private void Window_KeyDown(object sender, System.Windows.Input.KeyEventArgs e         


        
5条回答
  •  自闭症患者
    2020-12-20 18:24

    Overriding TextInput/PreviewTextInput (or listening to the events) should work.

    protected override void OnPreviewTextInput(TextCompositionEventArgs e)
    {
        base.OnPreviewTextInput(e);
        Console.WriteLine(e.Text);
    }
    

提交回复
热议问题