Table of Contents

Property UndoList

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

UndoList

Provides an indexed access to undo data.

[Browsable(false)]
public virtual IUndoList UndoList { get; }

Property Value

IUndoList

Examples

Here is how to use a UndoList 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)
    {
        foreach (UndoData undoData in textSource.UndoList)
        {
            Console.WriteLine(undoData.Operation);
        }
    }
}

Here is how to use a UndoList 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)
        For Each undoData As UndoData In textSource.UndoList
            Console.WriteLine(undoData.Operation)
    End Sub
End Class

Remarks

TextSource can store an unlimited number of the undo\redo operations unless UndoLimit property specifies otherwise.

Any operation that has been performed within the text, such as text insertion or deletion, is automatically added to the UndoList so that it can be undone.