C#/WPF
WPF tutorial -The WrapPanel
광그로
2017. 6. 22. 17:12
http://www.wpf-tutorial.com/panels/wrappanel/
밑의 예제는 우측으로 버튼을 나열한 것입니다. 출력결과에서는 더이상의 공간이 없기 때문에, Test button 5와 Test button 6이 다음 줄에서 부터 시작하게 됩니다.
또한, 수평 방향에서는 하위 컨트롤 중 height이 가장 높은 컨트롤을 기준으로 height이 지정됩니다.(단, 컨트롤에 직접 height을 부여하지 않을 시)
이때, 창사이즈를 우측으로 늘이면 Test button 5, 6은 button 4의 오른편에 위치하게 됩니다.
1 2 3 4 5 6 7 8 | <WrapPanel> <Button >Test button 1</Button> <Button Height="60">Test button 2</Button> <Button>Test button 3</Button> <Button Height="40">Test button 4</Button> <Button>Test button 5</Button> <Button>Test button 6</Button> </WrapPanel> | cs |
1 | <WrapPanel Orientation="Vertical"> | cs |
WrapPanel의 속성을 Vertical로 지정하게 되면, 컨트롤들이 수직으로 나열됩니다.
수직 방향의 경우, width에 영향을 받습니다. (height의 영향은 받지 않습니다.)