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>

적용 대상