--- title: "How to: Change the FlowDirection of Content Programmatically" ms.date: "03/30/2017" ms.custom: devdivchpfy22 description: Learn how to change the FlowDirection of content programmatically. dev_langs: - "csharp" - "vb" helpviewer_keywords: - "FlowDirection property [WPF], changing programmatically" - "documents [WPF], changing FlowDirection property programmatically" ms.assetid: 02f5a8ba-f8c0-4e5a-84b9-4c5bf12922a2 --- # How to: Change the FlowDirection of Content Programmatically This example shows how to programmatically change the property of a . ## Create button elements Two elements are created, each representing one of the possible values of . When a button is clicked, the associated property value is applied to the contents of a named `tf1`. The property value is also written to a named `txt1`. [!code-xaml[FlowDirectionSnippets#_FlowDirectionXAML](~/samples/snippets/csharp/VS_Snippets_Wpf/FlowDirectionSnippets/CSharp/Window1.xaml#_flowdirectionxaml)] ## C# code example The events associated with the button clicks defined above are handled in a C# code-behind file. [!code-csharp[FlowDirectionSnippets#_FlowDirection](~/samples/snippets/csharp/VS_Snippets_Wpf/FlowDirectionSnippets/CSharp/Window1.xaml.cs#_flowdirection)] [!code-vb[FlowDirectionSnippets#_FlowDirection](~/samples/snippets/visualbasic/VS_Snippets_Wpf/FlowDirectionSnippets/VisualBasic/Window1.xaml.vb#_flowdirection)]