In winform, if i wanted to get the ascii code of a key pressed i would do like so:
Private void textbox1_KeyPress(object sender, KeyEventArgs e)
{
    int i = e.KeyChar;
}
how would i go about doing like so in WPF? Also, is KeyPress in winforms the equivalent of KeyDown in WPF?
You need to capture the KeyDown event in WPF as follows:
    private void TextBox1_KeyDown(object sender, KeyEventArgs e)
    {
        int ascii = KeyInterop.VirtualKeyFromKey(e.Key);
    }
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With