Table of Contents

Property ReadOnly

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

ReadOnly

Gets or sets a value indicating whether the control's content is read-only.

public virtual bool ReadOnly { get; set; }

Property Value

bool

Examples

Here is how to use a ReadOnly 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.LoadFile("myfile.txt");
        textEditor.ReadOnly = true;
    }
}

Here is how to use a ReadOnly 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()
        textEditor.LoadFile("myfile.txt")
        textEditor.ReadOnly = True
    End Sub
End Class

Remarks

Setting ReadOnly property to true will restrict any changes TextEditor control content.

You can also set SetLineReadonly method to make some lines read-only rather than the entire content.