Setting Culture / Language in RichTextBox WPF
-
22-08-2019 - |
Question
Hi there is possible to set a default language or set a new one in RichTextBox, i want to set it in "es-PE" for spellchecker propouses
Thanks!
Solution
It would seem to be possible setting the xml:lang as in the code below:
<StackPanel>
<RichTextBox SpellCheck.IsEnabled="True"/>
<RichTextBox SpellCheck.IsEnabled="True" xml:lang="es-PE"/>
</StackPanel>
The first box checks in the default culture and the second in the specified one ("es-PE").
The documentation also suggests you could add this attribute to a parent control such as a panel and it will be inherited by the child controls.
OTHER TIPS
Have you tried setting the current thread's culture to the one you want? Most stuff in .NET takes the culture from the thread.
Thread.CurrentThread.CurrentCulture = new Culture( "es-PE" );
Thread.CurrentThread.CurrentUICulture = Thread.CurrentThread.CurrentCulture;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow