Files
docs-desktop/dotnet-desktop-guide/framework/wpf/controls/how-to-create-a-multiline-textbox-control.md
T
Andy De George da363692ff Initial WPF content migrated (#17)
* Reset branch for WPF changes

* Convert BMP to PNG; fix link-out-of-scope err

* Add snippets for WPF... 6794 files!!!!

* Add missing snippets

* update file updated between migration

* Fix paths to include

* update breadcrumb and toc

* fix index links

* fix index links

* fix index links

* fix markdown
2020-09-04 09:46:28 -07:00

1.9 KiB

title, description, ms.date, helpviewer_keywords, ms.assetid
title description ms.date helpviewer_keywords ms.assetid
How to: Create a Multiline TextBox Control Learn how to use XAML to define a TextBox control that expands to accommodate multiple lines of text in a Windows Presentation Foundation application. 03/30/2017
TextBox control [WPF], multiple lines of text
05914a93-d0ea-4a9a-b693-09df7d4e2ac2

How to: Create a Multiline TextBox Control

This example shows how to use [!INCLUDETLA#tla_xaml] to define a xref:System.Windows.Controls.TextBox control that will automatically expand to accommodate multiple lines of text.

Example

Setting the xref:System.Windows.Controls.TextBox.TextWrapping%2A attribute to Wrap will cause entered text to wrap to a new line when the edge of the xref:System.Windows.Controls.TextBox control is reached, automatically expanding the xref:System.Windows.Controls.TextBox control to include room for a new line, if necessary.

Setting the xref:System.Windows.Controls.Primitives.TextBoxBase.AcceptsReturn%2A attribute to true causes a new line to be inserted when the RETURN key is pressed, once again automatically expanding the xref:System.Windows.Controls.TextBox to include room for a new line, if necessary.

The xref:System.Windows.Controls.Primitives.TextBoxBase.VerticalScrollBarVisibility%2A attribute adds a scroll bar to the xref:System.Windows.Controls.TextBox, so that the contents of the xref:System.Windows.Controls.TextBox can be scrolled through if the xref:System.Windows.Controls.TextBox expands beyond the size of the frame or window that encloses it.

[!code-xamlTextBox_MiscCode#_MultilineTextBoxXAML]

See also