layout | title | description | platform | control | documentation |
---|---|---|---|---|---|
post |
Getting Started with UWP Spell Checker control | Syncfusion |
Learn here about getting started with Syncfusion UWP Spell Checker (SfSpellChecker) control, its elements and more. |
UWP |
SfSpellChecker |
ug |
Spell checking operation can be done on Text editor controls through SfSpellChecker
in UWP application by implementing IEditorProperties
interface.
The following steps helps to add SfSpellChecker
.
1 . Create a UWP project in Visual Studio and include Syncfusion.SfSpellChecker.UWP
assembly.
2 . Create an instance of SfSpellChecker
using “Syncfusion.UI.Xaml.Controls” namespace.
{% tabs %}
{% highlight C# %}
Syncfusion.UI.Xaml.Controls.SfSpellChecker spellChecker = new Syncfusion.UI.Xaml.Controls.SfSpellChecker();
{% endhighlight %}
{% endtabs %}
3 . Create instance of Button and TextBox to input control for SpellCheck.
{% tabs %}
{% highlight XAML %}
{% endhighlight %}
{% endtabs %}
4 . Inherit IEditorProperties
interface of SfSpellChecker
and Initialize all the methods and properties in interface.
{% tabs %}
{% highlight C# %}
public class TextSpellEditor:IEditorProperties
{
TextBox textbox;
public TextSpellEditor(Control control)
{
ControlToSpellCheck = control;
}
public Control ControlToSpellCheck
{
get
{
return textbox;
}
set
{
textbox = value as TextBox;
}
}
public string SelectedText
{
get
{
return textbox.SelectedText;
}
set
{
textbox.SelectedText = value;
}
}
public string Text
{
get
{
return textbox.Text;
}
set
{
textbox.Text = value;
}
}
public void Select(int selectionStart, int selectionLength)
{
textbox.Select(selectionStart, selectionLength);
}
public bool HasMoreTextToCheck()
{
return false;
}
public void Focus()
{
textbox.Focus();
}
public void UpdateTextField()
{
throw new NotImplementedException();
}
}
{% endhighlight %}
{% endtabs %}
5 . In Click event of button call SpellCheck method to TextBox.
{% tabs %}
{% highlight C# %}
private void Button_Click(object sender, RoutedEventArgs e)
{
SpellChecker.PerformSpellCheckUsingDialog(Editor);
}
{% endhighlight %}
{% endtabs %}
6 . Selected word in suggestion list can be replaced click Replace button in the spell check dialog.