Files
docs-desktop/dotnet-desktop-guide/framework/wpf/advanced/how-to-change-the-flowdirection-of-content-programmatically.md
T
Pooja PoojariandAndy De George caa62283b8 US-1889327: Suggestion/warning fixes for WPF. (#1314)
* Suggestion/warning fixes for US-1889327.

* Updated H2s.

* Minor content edit.

* Review edits.

* Minor edits.

* Update dotnet-desktop-guide/framework/wpf/advanced/localization-attributes-and-comments.md

Co-authored-by: Andy (Steve) De George <[email protected]>
2022-02-23 10:27:19 -08:00

1.7 KiB

title, ms.date, ms.custom, description, dev_langs, helpviewer_keywords, ms.assetid
title ms.date ms.custom description dev_langs helpviewer_keywords ms.assetid
How to: Change the FlowDirection of Content Programmatically 03/30/2017 devdivchpfy22 Learn how to change the FlowDirection of content programmatically.
csharp
vb
FlowDirection property [WPF], changing programmatically
documents [WPF], changing FlowDirection property programmatically
02f5a8ba-f8c0-4e5a-84b9-4c5bf12922a2

How to: Change the FlowDirection of Content Programmatically

This example shows how to programmatically change the xref:System.Windows.FrameworkElement.FlowDirection%2A property of a xref:System.Windows.Controls.FlowDocumentReader.

Create button elements

Two xref:System.Windows.Controls.Button elements are created, each representing one of the possible values of xref:System.Windows.FlowDirection. When a button is clicked, the associated property value is applied to the contents of a xref:System.Windows.Controls.FlowDocumentReader named tf1. The property value is also written to a xref:System.Windows.Controls.TextBlock named txt1.

[!code-xamlFlowDirectionSnippets#_FlowDirectionXAML]

C# code example

The events associated with the button clicks defined above are handled in a C# code-behind file.

[!code-csharpFlowDirectionSnippets#_FlowDirection] [!code-vbFlowDirectionSnippets#_FlowDirection]