StackPanel.Orientation Свойство

Определение

Возвращает или задает измерение, по которому сложены дочерние элементы.

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"/>

Значение свойства

Одно из значений перечисления, указывающее ориентацию дочерних элементов. Значение по умолчанию — Vertical.

Примеры

В следующем примере создается горизонтальный список элементов, задав для свойства Orientation значение 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>

Применяется к