Class SfSpellChecker
SfSpellChecker control helps to find erroneous spelling in a editor and provides suggestions for it.
Inheritance
Implements
Namespace: Syncfusion.Windows.Controls
Assembly: Syncfusion.SfSpellChecker.WPF.dll
Syntax
public class SfSpellChecker : DependencyObject, IDisposable
Constructors
SfSpellChecker()
Initializes the instance of SfSpellChecker.
Declaration
public SfSpellChecker()
Fields
CultureProperty
Identifies the Culture dependency property.
Declaration
public static readonly DependencyProperty CultureProperty
Field Value
| Type |
|---|
| System.Windows.DependencyProperty |
CustomDictionaryPathProperty
Using a DependencyProperty as the backing store for CustomDictionaryPath. This enables animation, styling, binding, etc...
Declaration
public static readonly DependencyProperty CustomDictionaryPathProperty
Field Value
| Type |
|---|
| System.Windows.DependencyProperty |
DictionariesProperty
Identifies the Dictionaries dependency property.
Declaration
public static readonly DependencyProperty DictionariesProperty
Field Value
| Type |
|---|
| System.Windows.DependencyProperty |
EnableContextMenuProperty
Identifies the EnableContextMenu dependency property.
Declaration
public static readonly DependencyProperty EnableContextMenuProperty
Field Value
| Type |
|---|
| System.Windows.DependencyProperty |
EnableSpellCheckProperty
Identifies the EnableSpellCheck dependency property.
Declaration
public static readonly DependencyProperty EnableSpellCheckProperty
Field Value
| Type |
|---|
| System.Windows.DependencyProperty |
IgnoreAlphaNumericWordsProperty
Using a DependencyProperty as the backing store for IgnoreAlphaNumericWords. This enables animation, styling, binding, etc...
Declaration
public static readonly DependencyProperty IgnoreAlphaNumericWordsProperty
Field Value
| Type |
|---|
| System.Windows.DependencyProperty |
IgnoreEmailAddressProperty
Using a DependencyProperty as the backing store for IgnoreEmailAddress. This enables animation, styling, binding, etc...
Declaration
public static readonly DependencyProperty IgnoreEmailAddressProperty
Field Value
| Type |
|---|
| System.Windows.DependencyProperty |
IgnoreHtmlTagsProperty
Using a DependencyProperty as the backing store for IgnoreHtmlTags. This enables animation, styling, binding, etc...
Declaration
public static readonly DependencyProperty IgnoreHtmlTagsProperty
Field Value
| Type |
|---|
| System.Windows.DependencyProperty |
IgnoreMixedCaseWordsProperty
Using a DependencyProperty as the backing store for IgnoreMixedCaseWords. This enables animation, styling, binding, etc...
Declaration
public static readonly DependencyProperty IgnoreMixedCaseWordsProperty
Field Value
| Type |
|---|
| System.Windows.DependencyProperty |
IgnoreUpperCaseWordsProperty
Using a DependencyProperty as the backing store for IgnoreUpperCaseWords. This enables animation, styling, binding, etc...
Declaration
public static readonly DependencyProperty IgnoreUpperCaseWordsProperty
Field Value
| Type |
|---|
| System.Windows.DependencyProperty |
IgnoreUrlProperty
Using a DependencyProperty as the backing store for IgnoreUrl. This enables animation, styling, binding, etc...
Declaration
public static readonly DependencyProperty IgnoreUrlProperty
Field Value
| Type |
|---|
| System.Windows.DependencyProperty |
SpellCheckerProperty
Identifies the SpellCheckerProperty attached dependency property.
Declaration
public static readonly DependencyProperty SpellCheckerProperty
Field Value
| Type |
|---|
| System.Windows.DependencyProperty |
Properties
Culture
Gets or sets the culture, which is used to pick corresponding dictionary for spell check.
Declaration
public CultureInfo Culture { get; set; }
Property Value
| Type |
|---|
| System.Globalization.CultureInfo |
Examples
var english = new HunspellDictionary(); english.Culture = new CultureInfo("en-us"); english.DictionaryUri = new Uri("/SpellCheckerDemo;component//english.dic"); english.GrammarUri = new Uri("/SpellCheckerDemo;component//english.aff");
var french = new IspellDictionary(); french.Culture = new CultureInfo("fr"); french.DictionaryUri = new Uri("/SpellCheckerDemo;component//french.dic"); french.GrammarUri = new Uri("/SpellCheckerDemo;component//french.xlg");
var custom = new CustomDictionary(); custom.Culture = new CultureInfo("en-us"); english.DictionaryUri = new Uri("/Resources/custom.dic");
var dictionaries = new DictionaryCollection(); dictionaries.Add(english); dictionaries.Add(french); dictionaries.Add(custom);
spellChecker.Dictionaries = dictionaries; spellChecker.Culture = new CultureInfo("en-us");
CustomDictionaryPath
gets or sets string value for user dictionary path.
Declaration
public string CustomDictionaryPath { get; set; }
Property Value
| Type |
|---|
| System.String |
Dictionaries
Get or sets a list of available dictionaries.
Declaration
public DictionaryCollection Dictionaries { get; set; }
Property Value
| Type |
|---|
| DictionaryCollection |
Remarks
One dictionary per culture is stored here. If multiple dictionary is specified for a culture, first one is picked. Extra words can be stored in custom dictionary. Any words added using ‘Add to dictionary’, is also stored in this custom dictionary. The following types can be added to this collection.
Examples
var english = new HunspellDictionary(); english.Culture = new CultureInfo("en-us"); english.DictionaryUri = new Uri("/SpellCheckerDemo;component//english.dic"); english.GrammarUri = new Uri("/SpellCheckerDemo;component//english.aff");
var french = new IspellDictionary(); french.Culture = new CultureInfo("fr"); french.DictionaryUri = new Uri("/SpellCheckerDemo;component//french.dic"); french.GrammarUri = new Uri("/SpellCheckerDemo;component//french.xlg");
var custom = new CustomDictionary(); custom.Culture = new CultureInfo("en-us"); english.DictionaryUri = new Uri("/Resources/custom.dic");
var dictionaries = new DictionaryCollection(); dictionaries.Add(english); dictionaries.Add(french); dictionaries.Add(custom);
spellChecker.Dictionaries = dictionaries; spellChecker.Culture = new CultureInfo("en-us");
EnableContextMenu
Gets or sets the value indicating whether the ContextMenu can be shown. It is used to show the suggestion for wrong words, and built in commands. Default value is true.
Declaration
public bool EnableContextMenu { get; set; }
Property Value
| Type |
|---|
| System.Boolean |
Remarks
SpellCheck operations will be processed only if the EnableSpellCheck property is true. Default TextBox’s ContextMenu will be overridden.
EnableSpellCheck
Gets or sets the value indicating whether the SpellCheck operation should be take place. By default the value is true.
Declaration
public bool EnableSpellCheck { get; set; }
Property Value
| Type |
|---|
| System.Boolean |
IgnoreAlphaNumericWords
Gets or Sets the boolean value to check AlphaNumericWords
Declaration
public bool IgnoreAlphaNumericWords { get; set; }
Property Value
| Type |
|---|
| System.Boolean |
IgnoreEmailAddress
Gets or Sets the boolean value to check Email addresses
Declaration
public bool IgnoreEmailAddress { get; set; }
Property Value
| Type |
|---|
| System.Boolean |
IgnoreHtmlTags
Gets or Sets the boolean value to check HTML tags
Declaration
public bool IgnoreHtmlTags { get; set; }
Property Value
| Type |
|---|
| System.Boolean |
IgnoreMixedCaseWords
Gets or Sets the boolean value to check mixed case words
Declaration
public bool IgnoreMixedCaseWords { get; set; }
Property Value
| Type |
|---|
| System.Boolean |
IgnoreUpperCaseWords
Gets or Sets the boolean value to check upper case words
Declaration
public bool IgnoreUpperCaseWords { get; set; }
Property Value
| Type |
|---|
| System.Boolean |
IgnoreUrl
Gets or Sets the boolean value to check URLs.
Declaration
public bool IgnoreUrl { get; set; }
Property Value
| Type |
|---|
| System.Boolean |
Methods
Dispose()
Disposes the instance of SfSpellChecker
Declaration
public void Dispose()
GetAnagrams(String)
Returns the anagrams for error word
Declaration
public List<string> GetAnagrams(string word)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | word |
Returns
| Type |
|---|
| System.Collections.Generic.List<System.String> |
GetPhoneticWords(String)
Returns the phonetic suggestions for error word in medium accuracy
Declaration
public List<string> GetPhoneticWords(string word)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | word |
Returns
| Type |
|---|
| System.Collections.Generic.List<System.String> |
GetPhoneticWords(String, AccuracyLevels)
Returns the phonetic suggestions for error word in specified accuracy
Declaration
public List<string> GetPhoneticWords(string word, AccuracyLevels accuracy)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | word | |
| AccuracyLevels | accuracy |
Returns
| Type |
|---|
| System.Collections.Generic.List<System.String> |
GetSpellChecker(DependencyObject)
Gets the Spellchecker from the attached control
Declaration
public static SfSpellChecker GetSpellChecker(DependencyObject obj)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Windows.DependencyObject | obj | Used to specify the TextBox control |
Returns
| Type | Description |
|---|---|
| SfSpellChecker | Returns the value of the Spellchecker |
Examples
<TextBox Text="Text to be checked for spelling mistakes."> <syncfusion:SfSpellChecker.SpellChecker> <syncfusion:SfSpellChecker x:Name="spellChecker" /> </syncfusion:SfSpellChecker.SpellChecker> </TextBox>
GetSuggestions(String)
Returns the suggestions for error word
Declaration
public Dictionary<string, List<string>> GetSuggestions(string word)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | word |
Returns
| Type |
|---|
| System.Collections.Generic.Dictionary<System.String, System.Collections.Generic.List<System.String>> |
HasError(String)
Checks whether the word exists in dictionary
Declaration
public bool HasError(string word)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | word |
Returns
| Type |
|---|
| System.Boolean |
PerformSpellCheckUsingContextMenu()
Perform spell checking to the TextBox control with ContextMenu.
Declaration
public void PerformSpellCheckUsingContextMenu()
PerformSpellCheckUsingContextMenu(IEditorProperties)
Perform spell checking with ContextMenu in the editor control.
Declaration
public void PerformSpellCheckUsingContextMenu(IEditorProperties editor)
Parameters
| Type | Name | Description |
|---|---|---|
| IEditorProperties | editor |
PerformSpellCheckUsingDialog()
Perform spell checking to the TextBox control with dialog window.
Declaration
public void PerformSpellCheckUsingDialog()
PerformSpellCheckUsingDialog(IEditorProperties)
Perform spell checking with dialog window in the editor control.
Declaration
public void PerformSpellCheckUsingDialog(IEditorProperties editor)
Parameters
| Type | Name | Description |
|---|---|---|
| IEditorProperties | editor |
SetSpellChecker(DependencyObject, SfSpellChecker)
Sets the Spellchecker to the TextBox
Declaration
public static void SetSpellChecker(DependencyObject obj, SfSpellChecker value)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Windows.DependencyObject | obj | Used to specify the TextBox control |
| SfSpellChecker | value | Used to specify the SpellCheker instance |
Events
SpellCheckCompleted
Event which is handled after spell check operations are completed
Declaration
public event EventHandler SpellCheckCompleted
Event Type
| Type |
|---|
| System.EventHandler |