Files
docs-desktop/dotnet-desktop-guide/framework/wpf/advanced/how-to-change-the-textwrapping-property-programmatically.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.7 KiB

title, ms.date, dev_langs, helpviewer_keywords, ms.assetid
title ms.date dev_langs helpviewer_keywords ms.assetid
How to: Change the TextWrapping Property Programmatically 03/30/2017
csharp
vb
documents [WPF], changing TextWrapping property programmatically
TextWrapping property [WPF], changing programmatically
30d25554-4c82-4df9-a8d6-35683a4a13bb

How to: Change the TextWrapping Property Programmatically

Example

The following code example shows how to change the value of the xref:System.Windows.Controls.TextBlock.TextWrapping%2A property programmatically.

Three xref:System.Windows.Controls.Button elements are placed within a xref:System.Windows.Controls.StackPanel element in [!INCLUDETLA2#tla_xaml]. Each xref:System.Windows.Controls.Primitives.ButtonBase.Click event for a xref:System.Windows.Controls.Button corresponds with an event handler in the code. The event handlers use the same name as the xref:System.Windows.Controls.TextBlock.TextWrapping%2A value they will apply to txt2 when the button is clicked. Also, the text in txt1 (a xref:System.Windows.Controls.TextBlock not shown in the [!INCLUDETLA2#tla_xaml]) is updated to reflect the change in the property.

[!code-xamlTextWrapProperty#1]

[!code-csharpTextWrapProperty#2] [!code-vbTextWrapProperty#2]

See also