エディターが編集モードを離れると、このプロパティは False にリセットされます。つまり、エディターは編集モード中は有効です。編集モードでない時、このプロパティは False を返します。
Private Sub Button1_Click(ByVal sender As Object, ByVal e As RoutedEventArgs) ' When edit mode ends, the value will be committed and OriginalValue and ' HasValueChanged will be reset. Me.textEditor1.EndEditMode(True, False) Me.textEditor1.Value = "A" ' HasValueChanged and OriginalValue properties are only applicable during ' edit mode. These properties are set when the value of the editor is ' modified after entering edit mode. Me.textEditor1.StartEditMode() ' The following will print out 'A' and False respectively. Debug.WriteLine("After entering edit mode:") Debug.WriteLine("OriginalValue = '" & Me.textEditor1.OriginalValue & "'") Debug.WriteLine("HasValueChanged = " & Me.textEditor1.HasValueChanged) Me.textEditor1.Value = "B" ' The Value was modified to B above. The following will print out 'A' and ' True respectively. Debug.WriteLine("After changing value to B:") Debug.WriteLine("OriginalValue = '" & Me.textEditor1.OriginalValue & "'") Debug.WriteLine("HasValueChanged = " & Me.textEditor1.HasValueChanged) ' When edit mode ends, the value will be committed and HasValueChanged will ' be reset. Me.textEditor1.EndEditMode(True, False) ' The following will print out False. Debug.WriteLine("After exiting edit mode:") Debug.WriteLine("HasValueChanged = " & Me.textEditor1.HasValueChanged) End Sub
public void button1_Click( object sender, RoutedEventArgs e ) { // When edit mode ends, the value will be committed and OriginalValue and // HasValueChanged will be reset. this.textEditor1.EndEditMode( true, false ); this.textEditor1.Value = "A"; // HasValueChanged and OriginalValue properties are only applicable during // edit mode. These properties are set when the value of the editor is // modified after entering edit mode. this.textEditor1.StartEditMode( ); // The following will print out 'A' and False respectively. Debug.WriteLine( "After entering edit mode:" ); Debug.WriteLine( "OriginalValue = '" + this.textEditor1.OriginalValue + "'" ); Debug.WriteLine( "HasValueChanged = " + this.textEditor1.HasValueChanged ); this.textEditor1.Value = "B"; // The Value was modified to B above. The following will print out 'A' and // True respectively. Debug.WriteLine( "After changing value to B:" ); Debug.WriteLine( "OriginalValue = '" + this.textEditor1.OriginalValue + "'" ); Debug.WriteLine( "HasValueChanged = " + this.textEditor1.HasValueChanged ); // When edit mode ends, the value will be committed and HasValueChanged will // be reset. this.textEditor1.EndEditMode( true, false ); // The following will print out False. Debug.WriteLine( "After exiting edit mode:" ); Debug.WriteLine( "HasValueChanged = " + this.textEditor1.HasValueChanged ); }