Property ActiveEdit
ActiveEdit
Gets or sets an object that represent currently active (focused) TextEditor
control linked to the text source.
[Browsable(false)]
public virtual TextEditor ActiveEdit { get; set; }
Property Value
Examples
Here is how to use a ActiveEdit in the C# code:
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();
var textEdit2 = new TextEditor();
textSource = new TextSource();
textSource.LoadFile("myfile.txt");
textEdit1.Source = this.textSource;
textEdit2.Source = this.textSource;
}
private void Button_Click(object sender, RoutedEventArgs e)
{
if (textSource.ActiveEdit != null)
textSource.ActiveEdit.Selection.SelectAll();
}
}
Here is how to use a ActiveEdit in the Visual Basic code:
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()
Dim textEdit2 = New TextEditor()
textSource = New TextSource()
textSource.LoadFile("myfile.txt")
textEdit1.Source = Me.textSource
textEdit2.Source = Me.textSource
End Sub
Private Sub Button_Click(ByVal sender As Object, ByVal e As RoutedEventArgs)
If textSource.ActiveEdit IsNot Nothing Then textSource.ActiveEdit.Selection.SelectAll()
End Sub
End Class
Remarks
One or more TextEditor controls can edit the text stored in the TextSource object.
Use the ActiveEdit property to determine which of the TextEditor controls associated with the source have the input focus.