GridSplitter使用,包括最大最小限制

 

<Window x:Class="WpfApp1.PageWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
        xmlns:ribbon="clr-namespace:Microsoft.Windows.Controls.Ribbon;assembly=RibbonControlsLibrary" 
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:CustomSystemWindow.CustomWindow"
        mc:Ignorable="d" Title="PageWindow" WindowState="Maximized" Height="300" Width="600">

    <Grid>
        <Grid.RowDefinitions/>
        <Grid.ColumnDefinitions>
            <ColumnDefinition/>
            <ColumnDefinition Width="10"/>
            <ColumnDefinition/>
        </Grid.ColumnDefinitions>

        <TextBlock Grid.Row="0" Grid.Column="0" Text="左侧测试"/>
        <GridSplitter Grid.Row="0" Grid.Column="1" Width="10" HorizontalAlignment="Center" VerticalAlignment="Stretch" Background="Gray"  />

        <Grid Grid.Row="0" Grid.Column="2">
            <Grid.RowDefinitions>
                <RowDefinition MinHeight="200"/>
                <RowDefinition Height="10"/>
                <RowDefinition MinHeight="200"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition/>
            </Grid.ColumnDefinitions>
            <TextBlock Grid.Row="0" Grid.Column="0" Text="右上测试"/>
            <GridSplitter Grid.Row="1" Grid.Column="0" Height="10" HorizontalAlignment="Stretch" Background="Wheat"/>
            <TextBlock Grid.Row="2" Grid.Column="0" Text="右下测试"/>

        </Grid>
    </Grid>
</Window>

 

结果:

 

posted @ 2023-04-10 18:16  安静点--  阅读(103)  评论(0)    收藏  举报