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

適用於

另請參閱