I am working on an application which supports many languages including Arabic. I am observing an odd behavior in the WPF text box while entering the values but strangely the same is working fine in a Windows Form text box.
All I am doing is this
- Create a Text Box and keep it's flow direction to the default value which is LeftToRight
- Change the language of the app to Arabic.
Type the following letter one by one in the text box 1 a 2 j
(where a and j denotes any two Arabic character).
Result : Wpf Text box shows the value as 1j2a While the Win forms text box displays it as j2a1.
Since Arabic is right to left , so the value shown by Win form is correct but that of WPF is wrong.
Wpf displays the correct value if we type the first character as Arabic and then enter any non-Arabic character.
Also, if I set the FlowDirection of the TextBox to RightToLeft, then WPF textbox works fine. But that will make my string move to the right and the app will have alignment issues.
Does anyone have any idea on why WPF text box shows the incorrect value while windows forms works fine ?
Also, can we keep the text aligned to left if we set the flow direction as RightToLeft ?