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">
<Label Name = "lblInstruction"
FontSize = "15">Enter Car Information</Label>
<Label Name = "lblMake">Make</Label>
<TextBox Name = "txtMake"/>
<Label Name = "lblColor">Color</Label>
<TextBox Name = "txtColor"/>
<Label Name = "lblPetName">Pet Name</Label>
<TextBox Name = "txtPetName"/>
<Button Name = "btnOK">OK</Button>
</StackPanel>
If you set the Orientation property to horizontal, you would find the following layout:
<StackPanel Background = "LightSteelBlue" Orientation = "Horizontal">
...
</StackPanel>
StackPanel
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