TextBoxBase.CanUndo 属性

定义

获取一个值,该值指示是否可撤消最新的操作。Gets a value that indicates whether the most recent action can be undone.

public:
 property bool CanUndo { bool get(); };
public bool CanUndo { get; }
member this.CanUndo : bool
Public ReadOnly Property CanUndo As Boolean

属性值

true如果可撤消最新的操作, 则为;否则为falsetrue if the most recent action can be undone; otherwise, false.

此属性没有默认值。This property has no default value.

示例

下面的代码示例演示如何使用CanUndo属性来确定是否可以撤消最新的操作。The following code example demonstrates how to use the CanUndo property to determine whether the most recent action can be undone.

private void undoAction(object sender, RoutedEventArgs e)
{
    if (myTextBox.CanUndo == true)
    {
        myTextBox.Undo();
    }
}
Private Sub undoAction(ByVal sender As Object, ByVal e As RoutedEventArgs)
    If myTextBox.CanUndo = True Then
        myTextBox.Undo()
    Else : Return
    End If
End Sub

适用于

另请参阅