RichTextBox.AcceptsReturn Property


Gets or sets a value that determines whether the RichTextBox allows and displays the newline or return characters when the ENTER or RETURN keys are pressed.

Namespace:  System.Windows.Controls
Assembly:  System.Windows (in System.Windows.dll)

public bool AcceptsReturn { get; set; }
<RichTextBox AcceptsReturn="bool"/>

Property Value

Type: System.Boolean
true if the RichTextBox allows newline characters; otherwise, false. The default is true.

You can disable multi-line content in a RichTextBox control by using the AcceptsReturn property. Use the HorizontalScrollBarVisibility or VerticalScrollBarVisibility to enable the horizontal scrollbars or the vertical scrollbars.

The following XAML shows how to use the AcceptsReturn property.

<RichTextBox Margin="20,20,0,0" Width="300" Height="50" TextWrapping="Wrap" AcceptsReturn="True">
        A RichTextBox that demonstrates TextWrapping and AcceptsReturn properties


Supported in: 5, 4

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Ajouts de la communauté