I worked in winfoms previously. There was KeyPress event. So I can get the KeyChar.
The below code worked in winforms
Dim allowedChars as String = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz "
If allowedChars.IndexOf(e.KeyChar) = -1
If Not e.KeyChar = Chr(Keys.Back) Then
e.Handled = True
Beep()
End If
End If
But in WPF I dont know how to implement the above code?