Table of Contents

Property AutoCorrection

Namespace
Alternet.Editor.Wpf
Assembly
Alternet.Editor.Wpf.v9.dll

AutoCorrection

Gets or sets a boolean value indicating whether to auto correct words being typed.

public virtual bool AutoCorrection { get; set; }

Property Value

bool

Examples

Here is how to use a AutoCorrection in the C# code:

public partial class MainWindow : Window
{
    private void Window_Loaded(object sender, RoutedEventArgs e)
    {
        var textEditor = new Alternet.Editor.Wpf.TextEditor();
        textEditor.Source.CheckSpelling = true;
        textEditor.AutoCorrection = true;
        textEditor.AutoCorrectDelimiters = (Alternet.Editor.EditConsts.Wpf.DefaultAutoCorrectDelimiters + "'").ToCharArray();
        textEditor.AutoCorrect += textEditor_AutoCorrect;
    }

    private void textEditor_AutoCorrect(object sender, Alternet.Editor.Wpf.AutoCorrectEventArgs e)
    {
        switch (e.Word)
        {
            case "String":
                e.CorrectWord = "string";
                e.HasCorrection = true;
                break;
        }
    }
}

Here is how to use a AutoCorrection in the Visual Basic code:

Partial Public Class MainWindow

    Private Sub Window_Loaded(ByVal sender As Object, ByVal e As RoutedEventArgs)
        Dim textEditor = New Alternet.Editor.Wpf.TextEditor(Me.components)
        textEditor.Source.CheckSpelling = True
        textEditor.AutoCorrection = True
        textEditor.AutoCorrectDelimiters = (Alternet.Editor.Wpf.EditConsts.DefaultAutoCorrectDelimiters & "'").ToCharArray()
        AddHandler textEditor.AutoCorrect, New Alternet.Editor.Wpf.AutoCorrectEvent(AddressOf Me.textEditor_AutoCorrect)
    End Sub

    Private Sub textEditor_AutoCorrect(ByVal sender As Object, ByVal e As Alternet.Editor.Wpf.AutoCorrectEventArgs)
        Select Case e.Word
            Case "String"
                e.CorrectWord = "string"
                e.HasCorrection = True
        End Select
    End Sub
End Class

Remarks

TextEditor control can be configured to automatically correct misspelled words as the user types by setting AutoCorrection property and handling AutoCorrect event to provide correct word spelling.