layout | title | description | platform | control | documentation |
---|---|---|---|---|---|
post |
Context Menu Suggestion in UWP Spell Checker control | Syncfusion |
Learn here all about Context Menu Suggestion support in Syncfusion UWP Spell Checker (SfSpellChecker) control and more. |
UWP |
SfSpellChecker |
ug |
SfSpellChecker
offers Microsoft Office application like context menu suggestions and helps to correct spell errors by choosing correct option from the listed suggestions.
The following steps helps to add context menu suggestion in the TextBox control.
-
Create a UWP project in Visual Studio.
-
Create a class which inherits
IEditorProperties
interface ofSfSpellChecker
and Initialize all the methods and properties.
{% tabs %}
{% highlight C# %}
public class TextSpellEditor:IEditorProperties
{
TextBox textbox;
public TextSpellEditor(Control control)
{
ControlToCheck = control;
}
public Control ControlToCheck
{
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(Windows.UI.Xaml.FocusState.Pointer);
}
public void UpdateTextField()
{
throw new NotImplementedException();
}
}
}
{% endhighlight %}
{% endtabs %}
- Initiate
PerformSpellCheckUsingContextMenu
method by passingIEditorProperties
interface argument.
{% tabs %}
{% highlight C# %}
TextSpellEditor TextEditor = new TextSpellEditor(Textboxx);
SpellEditor = TextEditor;
SpellChecker.PerformSpellCheckUsingContextMenu(SpellEditor);
{% endhighlight %}
{% endtabs %}