Table of Contents

Property Text

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

Text

Gets or sets text source content as a single string with the individual strings delimited by carriage returns.

public virtual string Text { get; set; }

Property Value

string

Examples

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

using System;
using System.Windows;
using Alternet.Editor.Wpf;

public partial class MainWindow : Window
{
    private TextSource textSource;
    private void Window_Loaded(object sender, RoutedEventArgs e)
    {
        var textEdit1 = new TextEditor();
        textSource = new TextSource();
        textSource.LoadFile("myfile.txt");

        textEdit1.Source = this.textSource;
    }

    private void Button_Click(object sender, RoutedEventArgs e)
    {
        Console.WriteLine(textSource.Text);
    }
}

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

Imports System
Imports System.Windows
Imports Alternet.Editor.Wpf

Partial Public Class MainWindow
    Inherits Window

    Private textSource As TextSource

    Private Sub Window_Loaded(ByVal sender As Object, ByVal e As RoutedEventArgs)
        Dim textEdit1 = New TextEditor()
        textSource = New TextSource()
        textSource.LoadFile("myfile.txt")

        textEdit1.Source = Me.textSource
    End Sub

    Private Sub Button_Click(ByVal sender As Object, ByVal e As RoutedEventArgs)
        Console.WriteLine(textSource.Text)
    End Sub
End Class

Remarks

Getting this property returns a string copy of the contents of the text stored by this TextSource object. Setting this property replaces the contents of the stored text with the specified string.