Table of Contents

Property Modified

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

Modified

Gets or sets a value indicating whether the control's text content is modified.

[Browsable(false)]
public virtual bool Modified { get; set; }

Property Value

bool

Examples

Here is how to use a Modified 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 SaveButton_Click(object sender, RoutedEventArgs e)
    {
        if (textSource.Modified)
            textSource.SaveFile(textSource.FileName);
    }
}

Here is how to use a Modified 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 SaveButton_Click(ByVal sender As Object, ByVal e As RoutedEventArgs)
        If textSource.Modified Then textSource.SaveFile(textSource.FileName)
    End Sub
End Class

Remarks

Use the Modified property to determine if the user has changed the text contents displayed by the linked TextEditor control since it was the last set or loaded from the file.