
Working with StackPanel
The StackPanel control arranges content into a single line that can be oriented horizontally or vertically (the
default), based on the value assigned to the Orientation property. It is very useful to ensure that part of the
screen real estate is stacked in a given order when the user resizes. Typically, StackPanels are embedded
within another larger container such as the Grid.
<StackPanel Background = "LightSteelBlue">
<TextBox Name = "txtColor" />
<TextBox Name = "txtPetName"/>
<TextBox Name = "txtMake" />
<TextBlock Name = "lblInstructions" FontSize = "15">Enter Car
Information</TextBlock>
<TextBlock Name = "lblColor">Color</TextBlock>
<TextBlock Name = "lblMake">Pet Name</TextBlock>
<TextBlock Name = "lblPetName">Make</TextBlock>
<Button Name = "btnOK" Width = "80" Content="OK"/>
</StackPanel>
If you set the Orientation property to horizontal, you would find the following layout:
<StackPanel Background = "LightSteelBlue" Orientation = "Horizontal">
...
</StackPanel>
Stack Panel
Table of Contents
Copyright (c) 2008. Intertech, Inc. All Rights Reserved. This information is to be used exclusively as an
online learning aid. Any attempts to copy, reproduce, or use for training is strictly prohibited.
Courseware
Training Resources
Tutorials
Services