Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In WPF, does PreviewTextInput always give a single character only?

Tags:

c#

wpf

When handling the PreviewTextInput event of a TextBox in WPF, can the Text property of the event argument (TextCompositionEventArgs) contain other than the last character input via the keyboard?

I gave it a thorough test and it seems to contain only the single character value of the last pressed key. However, I'm probably missing something obvious, as its type is String and not Char.

like image 910
Zoman Avatar asked Apr 30 '14 20:04

Zoman


1 Answers

From UIElement.PreviewTextInput documentation.

The keyboard is the primary means of PreviewTextInput; but speech, handwriting, and other input devices can also generate PreviewTextInput.

I would assume that non-keyboard sources are able to provide more than one letter at a time.

like image 117
GazTheDestroyer Avatar answered Sep 20 '22 13:09

GazTheDestroyer