问题
When I press "Shift + Space" to type half-space (when I 'm writing in Persian) in a RichTextBox, it just inserts space. It types all other Persian characters correctly, but when it comes to "Shift+Space", it types just space.
The name of this character is "ZERO WIDTH NON-JOINER" and the information is given in this link: http://www.fileformat.info/info/unicode/char/200c/index.htm.
I should mention that I fixed the problem by handling previewKewDown event; but I like to know what is the problem with this key combination in a RichTextBox.
thanks.
回答1:
I think the problem is simply with your keyboard layout in windows. Windows' keyboard layout for Persian simply does not support ZWNJ. If you use Iranian Standard Persian Keyboard (ISIRI 9147) (Version 2.0) from Persian Computing Community Site, it will be available.
回答2:
I believe that this functionality would need to be programmed as a part of the control (either the RichTextBox or some inherited class), but it appears that this is not the case.
One alternative I found on another website was to press Alt + 0157
(use the keypad with NumLock enabled to enter each digit, one at a time), although this isn't as good as your solution of overriding the previewKewDown
event.
回答3:
I was facing with the very same issue and fixed the problem in code-behind by handling the PreviewKeyDown
event.
Just wanted to add that my little research on the matter made me thinking that the xml:space
attribute on the underlying Run
element can be the cause of the issue.
Read about how whitespace is processed in XAML here.
来源:https://stackoverflow.com/questions/13116278/how-can-i-type-half-space-in-richtextbox