다음을 통해 공유


StackPanel.Orientation 속성

정의

자식 요소가 누적되는 차원을 나타내는 값을 가져오거나 설정합니다.

public:
 property System::Windows::Controls::Orientation Orientation { System::Windows::Controls::Orientation get(); void set(System::Windows::Controls::Orientation value); };
public System.Windows.Controls.Orientation Orientation { get; set; }
member this.Orientation : System.Windows.Controls.Orientation with get, set
Public Property Orientation As Orientation

속성 값

자식 콘텐츠의 형식입니다 Orientation .

예제

다음 예제에서는 속성을 사용 하 여 OrientationStackPanel 요소를 쌓는 방법을 지정 하는 방법을 보여 줍니다 (다른 위에 하나 또는 나란히).

<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">

  <!-- This StackPanel stacks two other StackPanels on top of each other. The
       first StackPanel stacks its items horizontally while the second stacks them
       vertically. -->
  <StackPanel>

    <!-- The items under this StackPanel are stacked horizontally. -->
    <StackPanel Orientation="Horizontal">
      <Border Background="SkyBlue">
        <TextBlock>Stacked Item #1</TextBlock>
      </Border>
      <Border Background="CadetBlue">
        <TextBlock>Stacked Item #2</TextBlock>
      </Border>
      <Border Background="LightGoldenRodYellow">
        <TextBlock>Stacked Item #3</TextBlock>
      </Border>
    </StackPanel>

    <!-- The items under this StackPanel are stacked Vertically. Note that Orientation 
         has a default value of "Vertical" but in this example the property is explicitely
         set for clarity. -->
    <StackPanel Orientation="Vertical">
      <Border Background="SkyBlue">
        <TextBlock>Stacked Item #1</TextBlock>
      </Border>
      <Border Background="CadetBlue">
        <TextBlock>Stacked Item #2</TextBlock>
      </Border>
      <Border Background="LightGoldenRodYellow">
        <TextBlock >Stacked Item #3</TextBlock>
      </Border>
    </StackPanel>
  </StackPanel>
  
</Page>

아래 스크린샷은 이 예제가 렌더링되는 방법을 보여 줍니다.

StackPanel 방향

설명

종속성 속성 정보

Item 가치
식별자 필드 OrientationProperty
메타데이터 속성이 다음으로 설정됩니다. true AffectsMeasure

적용 대상