KeyPress event equivalent in WPF

后端 未结 3 1880
广开言路
广开言路 2020-12-29 05:19

i have the following code in WPA, and i am trying to convert it to WPF. I tried Keydown instead of Keypress and changed, for example,

(e.keyChar == \'-\')          


        
3条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-29 05:53

    You're looking for the TextInput event, or perhaps PreviewTextInput.

    The EventArgs type is TextCompositionEventArgs; I believe you want the Text property here, but I'm not at all sure of that.

提交回复
热议问题