⭐Border
StackPanel
<Window x:Class="G24W1103WPFLayout.MainWindow"
xmlns="<http://schemas.microsoft.com/winfx/2006/xaml/presentation>"
xmlns:x="<http://schemas.microsoft.com/winfx/2006/xaml>"
xmlns:d="<http://schemas.microsoft.com/expression/blend/2008>"
xmlns:mc="<http://schemas.openxmlformats.org/markup-compatibility/2006>"
xmlns:local="clr-namespace:G24W1103WPFLayout"
mc:Ignorable="d"
Title="Layout" Height="450" Width="800">
<StackPanel>
<Button Content="눌러주세요"/>
<Button>또 눌러주세요</Button>
<Button Content="눌러주세요"/>
</StackPanel>
</Window>
Orientation
<Window x:Class="G24W1103WPFLayout.MainWindow"
xmlns="<http://schemas.microsoft.com/winfx/2006/xaml/presentation>"
xmlns:x="<http://schemas.microsoft.com/winfx/2006/xaml>"
xmlns:d="<http://schemas.microsoft.com/expression/blend/2008>"
xmlns:mc="<http://schemas.openxmlformats.org/markup-compatibility/2006>"
xmlns:local="clr-namespace:G24W1103WPFLayout"
mc:Ignorable="d"
Title="Layout" Height="450" Width="800">
<StackPanel Orientation="Horizontal">
<Button Content="눌러주세요"/>
<Button>또 눌러주세요</Button>
<Button Content="눌러주세요"/>
</StackPanel>
</Window>
가로 세로 혼합 배치(xmal)
<Window x:Class="G24W1103WPFLayout.MainWindow"
xmlns="<http://schemas.microsoft.com/winfx/2006/xaml/presentation>"
xmlns:x="<http://schemas.microsoft.com/winfx/2006/xaml>"
xmlns:d="<http://schemas.microsoft.com/expression/blend/2008>"
xmlns:mc="<http://schemas.openxmlformats.org/markup-compatibility/2006>"
xmlns:local="clr-namespace:G24W1103WPFLayout"
mc:Ignorable="d"
Title="Layout" Height="450" Width="800">
<StackPanel Orientation="Vertical">
<Button Content="눌러주세요"/>
<Button>또 눌러주세요</Button>
<StackPanel Orientation="Horizontal">
<Button Content="인사" Click="OnButton"/>
<Label x:Name="MyLabel" Content="안녕하세요" FontWeight="Bold"/>
</StackPanel>
<Button Content="눌러주세요"/>
</StackPanel>
</Window>
가로 세로 혼합 배치(xaml.cs)
using System.Windows;
namespace G24W1103WPFLayout {
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window {
public MainWindow() {
InitializeComponent();
}
private void OnButton(object sender, RoutedEventArgs e) {
MyLabel.Content = "오랜 만입니다.";
}
}
}
암기해야 하는거
DockPanel DockPanel. Dock=”right,left,top,bottom” 존나 중요함!!!!
UniformGrid를 쓰면 동일한 크기로 할 수 있음
<UniformGrid Rows="1">
<Button Content="버튼 5"/>
<Button Content="버튼 6"/>
<Button Content="버튼 7"/>
<Button Content="버튼 8"/>
</UniformGrid>
Grid
<Grid>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Button Content="버튼 1" Grid.Row="0" Grid.Column="0"/>
<Button Content="버튼 2" Grid.Row="0" Grid.Column="1"/>
<Button Content="버튼 3" Grid.Row="0" Grid.Column="2"/>
<Button Content="버튼 4" Grid.Row="0" Grid.Column="3"/>
<Button Content="버튼 5" Grid.Row="1" Grid.Column="0"/>
<Button Content="버튼 6" Grid.Row="1" Grid.Column="1"/>
<Button Content="버튼 7" Grid.Row="1" Grid.Column="2"/>
<Button Content="버튼 8" Grid.Row="1" Grid.Column="3"/>
</Grid>