Visual Studio/WPF > 컨트롤 > 레이아웃 > MinHeight/MaxHeight

운영 환경
Windows 7 Pro (32bit)
Microsoft Visual Studio 2017 Community
Sublime Text 2

@ WPF 4.5 입문 by 오타 카즈키
No.2727/9985

컨트롤 자신의 크기를 지정하는 프로퍼티로서 이하를 소개하고 있다.
  • Width
  • Height
  • MinWidth
  • MinHeight
  • MaxWidth
  • MinHeight
  • 참고 : MaxHeight의 실수 인 것 같습니다


  • MinHeight와 MaxHeight를 사용해 보았습니다.

    XAML
    <Window x:Class="_170425_t0650_gridSplitter.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:_170425_t0650_gridSplitter"
            mc:Ignorable="d"
            Title="MainWindow" Height="350" Width="525">
        <Grid ShowGridLines="True">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="*"/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="150"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <Button Grid.Row="0" Grid.ColumnSpan="2" Content="Menu"/>
            <Button Grid.Row="1" Grid.ColumnSpan="2" Content="Toolbar"/>
            <Button Grid.Row="3" Grid.ColumnSpan="2" Content="Status Bar"/>
            <Button Grid.Row="2" MinHeight ="50" MaxHeight="100"
                    Content="Tree" Margin="0,5,0,0"/>
            <GridSplitter Grid.Row="2" Grid.ColumnSpan="2" HorizontalAlignment="Stretch"
                          VerticalAlignment="Top" Height="5"/>
            <Button Grid.Row="2" Grid.Column="1" Content="Content" Margin="0,5,0,0"/>
        </Grid>
    </Window>
    

    Tree 버튼에 MaxHeight 적용 시.


    Tree 버튼에 MinHeight 적용 시.

    좋은 웹페이지 즐겨찾기