-->

Wednesday, September 25, 2013

How to Enable Spell Check in TextBox: WPF

How to Enable Spell Check in TextBox: WPF

WPF Textbox control is used to input some value by the user at run time. Now it is not sure that the entered values are correct, it means user can write anything wrong in the textbox. So it is programmer’s job to check the value and correct it if wrong.

WPF textbox control provides a spell check functionality something same as MS Word. We have to use SpellCheck and Language property of the textbox. SpellCheck will enable the feature and language will decide the language in which spell check is to be performed.

<TextBox Width="300" Height="25" Margin="5"
Text="This si not teh correct line written by teh usre"
SpellCheck.IsEnabled="True" Language="En-Us">
</TextBox>

The code above will show a textbox with the given text. According to US English language, the textbox will place some red lines on the wrong words, as shown in the following image.

Enable SpellCheck in WPF Textbox Control


As in MS Word, when we right click on the wrong word, then it will show some help options in the context menu, as shown in the following image:

Show Context Menu in WPF Textbox control spell check

Read other related articles

Also read other articles

© Copyright 2013 Computer Programming | All Right Reserved