Table of Contents

Property Source

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

Source

Gets or sets an object that implements ITextSource interface containing an actual string data displayed by the control.

public virtual ITextSource Source { get; set; }

Property Value

ITextSource

Examples

Here is how to set a Source different TextSource from the C# code:

public partial class MainWindow : Window
{
    private void Window_Loaded(object sender, RoutedEventArgs e)
    {
        var textEditor1 = new Alternet.Editor.Wpf.TextEditor();
        var textEditor2 = new Alternet.Editor.Wpf.TextEditor();
        var textSource = new Alternet.Editor.Wpf.TextSource();
        textSource.LoadFile("myfile.txt");
        textEditor1.Source = this.textSource;
        textEditor2.Source = this.textSource;
    }
}

Here is how to set a Source different TextSource from the Visual Basic code:

Partial Public Class MainWindow
    Private Sub Window_Loaded(ByVal sender As Object, ByVal e As RoutedEventArgs)
        Dim textEditor1 = New Alternet.Editor.Wpf.TextEditor()
        Dim textEditor2 = New Alternet.Editor.Wpf.TextEditor()
        Dim textSource = New Alternet.Editor.Wpf.TextSource()
        textSource.LoadFile("myfile.txt")
        textEditor1.Source = Me.textSource
        textEditor2.Source = Me.textSource
    End Sub
End Class

Remarks

Set this property to display text content from a different text source.

Source object can be assigned to several TextEditor controls so that they can provide multiple views of the text.