C#/WPF
[WPF] Grid, StackPanel, DockPanel
딸기우유중독
2022. 9. 6. 11:22
Grid
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
Grid가 ColumnDefinition만 지정되어 있다면 밑에는 뚫려있는 상자로 비유가능.
컨트롤의 Width을 ActualWidth로 지정하면 각 Column Width에 맞게 지정되지만
Height을 ActualHeight로 사용하면 Height이 무한대로 지정됨
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
RowDefinition을 지정해줘야 바닥이 막힌 상자가 만들어져서 ListBox 등 컨트롤의 크기를 지정할때 한계치가 있는 크기지정이 가능 (ActualHeight)
StackPanel
Control의 Height 크기에 따라 Height가 증가.
DockPanel
창의 최대치에 맞게 꽉 채움.
728x90