TextBoxBase.IsUndoEnabled TextBoxBase.IsUndoEnabled TextBoxBase.IsUndoEnabled TextBoxBase.IsUndoEnabled Property

定义

获取或设置一个值,该值指示文本编辑控件是否支持撤消功能。Gets or sets a value that indicates whether undo support is enabled for the text-editing control.

public:
 property bool IsUndoEnabled { bool get(); void set(bool value); };
public bool IsUndoEnabled { get; set; }
member this.IsUndoEnabled : bool with get, set
Public Property IsUndoEnabled As Boolean

属性值

如果启用撤消支持,则为 true;否则为 falsetrue if undo support is enabled; otherwise, false. 默认值为 trueThe default value is true.

示例

下面的示例演示如何使用中IsUndoEnabled 可扩展应用程序标记语言 (XAML)Extensible Application Markup Language (XAML)的属性。The following example demonstrates how to use the IsUndoEnabled property in 可扩展应用程序标记语言 (XAML)Extensible Application Markup Language (XAML).

<TextBox TextWrapping="Wrap"
         Name="myTextBox" 
         Width="500" 
         Height="200" 
         AcceptsReturn="True"
         IsUndoEnabled="True"
         VerticalScrollBarVisibility="Visible"
         HorizontalScrollBarVisibility="Auto" 
         Margin="25">

注解

将此属性设置false为可清除撤消堆栈。Setting this property to false clears the undo stack. 因此, 如果您禁用撤消, 然后重新启用它, 则撤消命令仍不起作用, 因为当您禁用 undo 时, 撤消堆栈会被清空。Therefore, if you disable undo and then re-enable it, undo commands still do not work because the undo stack was emptied when you disabled undo.

依赖项属性信息Dependency Property Information

标识符字段Identifier field IsUndoEnabledProperty
元数据属性设置为trueMetadata properties set to true NoneNone

适用于

另请参阅