--- title: "How to: Create a Multiline TextBox Control" description: Learn how to use XAML to define a TextBox control that expands to accommodate multiple lines of text in a Windows Presentation Foundation application. ms.date: "03/30/2017" helpviewer_keywords: - "TextBox control [WPF], multiple lines of text" ms.assetid: 05914a93-d0ea-4a9a-b693-09df7d4e2ac2 --- # How to: Create a Multiline TextBox Control This example shows how to use [!INCLUDE[TLA#tla_xaml](../../../includes/tlasharptla-xaml-md.md)] to define a control that will automatically expand to accommodate multiple lines of text. ## Example Setting the attribute to **Wrap** will cause entered text to wrap to a new line when the edge of the control is reached, automatically expanding the control to include room for a new line, if necessary. Setting the attribute to **true** causes a new line to be inserted when the RETURN key is pressed, once again automatically expanding the to include room for a new line, if necessary. The attribute adds a scroll bar to the , so that the contents of the can be scrolled through if the expands beyond the size of the frame or window that encloses it. [!code-xaml[TextBox_MiscCode#_MultilineTextBoxXAML](~/samples/snippets/csharp/VS_Snippets_Wpf/TextBox_MiscCode/CSharp/Window1.xaml#_multilinetextboxxaml)] ## See also - - [TextBox Overview](textbox-overview.md) - [RichTextBox Overview](richtextbox-overview.md)