Programming/C# - Window

C#/ WPF 4. 기본 wpf 다루기

esoog Polaris 2024. 9. 20. 16:20

# 이름 설정은 태그에 x:Name=" "

<Button Grid.Column="0"
                x:Name="btnSelect" Content="1. Select(불러오기)" Width="200"
                            Margin="10,10" Height="70" FontSize="18" FontWeight="Bold"
                            Background="LightSeaGreen" Foreground="Black" Click="btnSelect_Click"/>

 

 

 

 

# 기본 화면 구성은 <Grid></Grid> 사용

<Grid>
        <!-- 페이지 2행 -->
        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
        
        <!-- 페이지 3열 -->
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="Auto"/>
        </Grid.ColumnDefinitions>
</Grid>

 

# 위와 같이 행과 열을 구분해서 페이지 구성 할 수 있음.

"*" 는 가용공간 비율 모두 할당

"Auto" 는 자식요소 따라서 할당

예를들어, 1:1:2 비율로 나누기 위해서는 Width="1*", Width="1*", Width="2*" 이렇게 하면 된다.

 

반응형