Many users want to implement some spelling check functionality in their applications. Writing own spelling libraries is a hard task, so, there is a built-in SpellCheck functionality in the .NET Framework. At this time, it works in Windows Presentation Foundation applications.

Tutorial Requirements:
  • C# IDE (Visual Studio 2008 used in this tutorial)
  • .NET Framework 3.5

So, here we go.

1. Create a new C# WPF Application:

IPB Image

2. Add a TextBox to your form:

IPB Image

In the XAML tab, add the following code between TextBox tags:

CODE

SpellCheck.IsEnabled = "True"


You can add the same code in the standard C# code window. Just enter:

csharp

textBox1.SpellCheck.IsEnabled = True;


Now, launch the application. You get something like this:

IPB Image

If you enter incorrect words, these are underlined in red. If you right-click the word, you get some spelling suggestions to correct.

Congratulations! The project is done.