Lester's WPF\SL Blog

Simple, Easy & Beautiful

Enable SpellCheck

Enable SpellCheck

  • Comments 0

An interesting feature in WPF is the availability of spell checking, which is limited to English language for now.  The code is simple:

<StackPanel xmlns='http://schemas.microsoft.com/winfx/avalon/2005' xmlns:x='http://schemas.microsoft.com/winfx/xaml/2005'>
<TextBox IsSpellCheckEnabled="true"/> 
</StackPanel> 

As  you can see, the only addition is that of  "IsSpellCheckEnabled". Thats all that needs to go in the code. As of today, the spell checker provides spell correction choices. But, it's very handy if we want to create a MS Word like editor.

We also support spellers for Spanish,French and German. You specify the language using x:Lang tag in xaml.

In the case of a TextBox the language on the control sets the speller. In a richtextbox the keyboard language triggers the speller, so u could type english and then german. and you will have english speller working on english text and german on german text. You can, however, override these by specifying the lang tags on the runs.

An interesting property is the SpellingReform. More info on this can be found on this post