AcceptsReturn Property

RichTextBox.AcceptsReturn Property

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

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)
XMLNS for XAML: Not mapped to an xmlns.

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

Windows Phone OS

Supported in: 8.1, 8.0, 7.1

Windows Phone

© 2018 Microsoft