New to Telerik UI for WPF? Download free 30-day trial

Getting Started with WPF SpellChecker

RadSpellChecker is a control that allows you to spellcheck a number of controls including TextBox, RichTextBox, RadRichTextBox, RadGridView, DataGrid or any other control that complies with certain requirements.

RadRichTextBox has a built-in spell checker (RadDocumentSpellChecker) that provides similar functionality and the benefit of underlining the incorrect words with a red curly line. If you would like to use RadSpellChecker instead of the default spell checker you should disable the document spell checker by setting the property IsSpellCheckingEnabled = ”False”. This can be done, for example, in order to create a similar look of the RadRichTextBoxes and the TextBoxes in your application.

Using RadSpellChecker with TextBox, RichTextBox or RadRichTextBox

In order to use RadSpellChecker in your project, you need to add a reference to the following assemblies:

  • Telerik.Windows.Controls.dll
  • Telerik.Windows.Controls.Input.dll
  • Telerik.Windows.Controls.Navigation.dll
  • Telerik.Windows.Documents.Proofing.dll
  • Telerik.Windows.Documents.Proofing.Dictionaries.En-US.dll
  • Telerik.Windows.Documents.dll
  • Telerik.Windows.Documents.Core.dll
  • Telerik.Windows.Documents.FormatProviders.MsRichTextBoxXaml.dll

Adding Telerik Assemblies Using NuGet

To use RadSpellChecker when working with NuGet packages, install the Telerik.Windows.Documents.Proofing.for.Wpf.Xaml package. The package name may vary slightly based on the Telerik dlls set - Xaml or NoXaml

Read more about NuGet installation in the Installing UI for WPF from NuGet Package article.

After adding reference to the aforementioned dlls, you can use the static class RadSpellChecker and its Check(Control controlToSpellCheck, SpellCheckingMode mode) method.

private void Button_Click(object sender, RoutedEventArgs e) 
{ 
   RadSpellChecker.Check(this.textBox1, SpellCheckingMode.WordByWord); 
} 

For the RadSpellChecker to work properly there is just one more thing you need to provide: a class deriving from RadDictionary which loads a .TDF file containing a dictionary for a specific language. Such a class is defined in “Telerik.Windows.Documents.Proofing.Dictionaries.En-US” included in Telerik UI. It contains a dictionary you can use in order to spell check in English. If you reference it in your project, it will be loaded automatically by MEF.

Using RadSpellChecker with RadGridView or DataGrid

In order to use RadSpellChecker on a RadGridView or a DataGrid, you need to reference Telerik.Windows.Documents.Proofing.RadGridView or Telerik.Windows.Documents.Proofing.DataGrid respectively.

You can use RadSpellChecker for those controls by adding an attached property to the RadGridView (or DataGrid) itself and to the column you wish to have spellchecked.

To use the RadSpellChecker in XAML you have to declare the following namespace:

The attached property for Telerik RadGridView is telerik:RadGridViewSpellCheckHelper.IsSpellCheckingEnabled:

<telerik:RadGridView x:Name="radGridView" telerik:RadGridViewSpellCheckHelper.IsSpellCheckingEnabled="True"> 
   <telerik:RadGridView.Columns> 
      <telerik:GridViewDataColumn telerik:RadGridViewSpellCheckHelper.IsSpellCheckingEnabled="True"> 
         ... 
      </telerik:GridViewDataColumn> 
   </telerik:RadGridView.Columns> 
</telerik:RadGridView> 

And the one for DataGrid is telerik:DataGridSpellCheckHelper.IsSpellCheckingEnabled:

<sdk:DataGrid x:Name="dataGrid" telerik:DataGridSpellCheckHelper.IsSpellCheckingEnabled="True"> 
   <sdk:DataGrid.Columns> 
      <sdk:DataGridTemplateColumn telerik:DataGridSpellCheckHelper.IsSpellCheckingEnabled="True"> 
         ... 
      </sdk:DataGridTemplateColumn> 
   </sdk:DataGrid.Columns> 
</sdk:DataGrid> 

Of course the GridViewDataColumn (or DataGridTemplateColumn) should contain a single control that can be spellchecked (implements IControlSpellChecker interface). ReadMore

Using RadSpellChecker with Implicit Styles

When the theme is implictly set in your application, you should merge the required dictionaries. The full list of dictionaries needed for RadSpellChecker is available in the following snippet:

<ResourceDictionary Source="/Telerik.Windows.Themes.Office2019;component/Themes/Telerik.Windows.Controls.xaml"/> 
<ResourceDictionary Source="/Telerik.Windows.Themes.Office2019;component/Themes/Telerik.Windows.Documents.xaml"/> 
<ResourceDictionary Source="/Telerik.Windows.Themes.Office2019;component/Themes/Telerik.Windows.Controls.Input.xaml"/> 
<ResourceDictionary Source="/Telerik.Windows.Themes.Office2019;component/Themes/Telerik.Windows.Controls.Navigation.xaml"/> 
<ResourceDictionary Source="/Telerik.Windows.Themes.Office2019;component/Themes/Telerik.Windows.Documents.Proofing.xaml"/> 

Telerik UI for WPF Learning Resources

In this article