--- title: "How to: Apply Stretch Properties to the Contents of a Viewbox" ms.date: "03/30/2017" dev_langs: - "csharp" - "vb" helpviewer_keywords: - "StretchDirection properties [WPF]" - "Stretch properties [WPF]" - "controls [WPF], Viewbox" - "Viewbox control [WPF]" ms.assetid: b9c22ef4-bce4-4300-9e0c-8260b7db83cc --- # How to: Apply Stretch Properties to the Contents of a Viewbox ## Example This example shows how to change the value of the and properties of a . The first example uses [!INCLUDE[TLA#tla_xaml](../../../includes/tlasharptla-xaml-md.md)] to define a element. It assigns a and of 400. The example nests an element within the . elements that correspond to the property values for the and enumerations manipulate the stretching behavior of the nested . [!code-xaml[viewboxStretchLayoutSamp#1](~/samples/snippets/csharp/VS_Snippets_Wpf/viewboxStretchLayoutSamp/CSharp/Window1.xaml#1)] The following code-behind file handles the events that the previous [!INCLUDE[TLA2#tla_xaml](../../../includes/tla2sharptla-xaml-md.md)] example defines. [!code-csharp[viewboxStretchLayoutSamp#2](~/samples/snippets/csharp/VS_Snippets_Wpf/viewboxStretchLayoutSamp/CSharp/Window1.xaml.cs#2)] [!code-vb[viewboxStretchLayoutSamp#2](~/samples/snippets/visualbasic/VS_Snippets_Wpf/viewboxStretchLayoutSamp/VisualBasic/Window1.xaml.vb#2)] ## See also - - -