Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

StackPanel.Orientation Property

Definition

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Gets or sets the dimension by which child elements are stacked.

public:
 property Orientation Orientation { Orientation get(); void set(Orientation value); };
Orientation Orientation();

void Orientation(Orientation value);
public Orientation Orientation { get; set; }
var orientation = stackPanel.orientation;
stackPanel.orientation = orientation;
Public Property Orientation As Orientation
<StackPanel Orientation="Horizontal"/>
-or-
<StackPanel Orientation="Vertical"/>

Property Value

One of the enumeration values that specifies the orientation of child elements. The default is Vertical.

Examples

The following example creates a horizontal list of items by setting the Orientation property to Horizontal.

<StackPanel Orientation="Horizontal" Margin="20">
 <Rectangle Fill="Red" Width="50" Height="50" Margin="5" />
 <Rectangle Fill="Blue" Width="50" Height="50" Margin="5" />
 <Rectangle Fill="Green" Width="50" Height="50" Margin="5" />
 <Rectangle Fill="Purple" Width="50" Height="50" Margin="5" />
</StackPanel>

Applies to


Feedback

Was this page helpful?