Table of Contents

Property BookMarks

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

BookMarks

Represents an object that implements IBookMarks interface holding collection of IBookMark objects each determining particular bookmark within the text source.

[Browsable(false)]
public virtual IBookMarks BookMarks { get; set; }

Property Value

IBookMarks

Examples

Here is how to use a BookMarks 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;
        textEdit1.Source.BookMarks.SetBookMark(new Point(6, 1), 0);
        textEdit1.Source.BookMarks.SetBookMark(new Point(9, 15), 7);

        Random rnd = new Random();
        textEdit1.Source.BookMarks.ToggleBookMark(rnd.Next(textEdit1.Lines.Count - 1), int.MaxValue);

    }
}

Here is how to use a BookMarks 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
        textEdit1.Source.BookMarks.SetBookMark(New Point(6, 1), 0)
        textEdit1.Source.BookMarks.SetBookMark(New Point(9, 15), 7)
        Dim rnd As Random = New Random()
        textEdit1.Source.BookMarks.ToggleBookMark(rnd.[Next](textEdit1.Lines.Count - 1), Integer.MaxValue)
    End Sub
End Class

Remarks

You can use bookmarks to mark lines in the code to quickly return to a specific location or jump back and forth between locations.

Use Shared property to specify that bookmarks need to work across multiple documents.