WPF中GridSplitter控件的使用

通过代码来理解 GridSplitter 的用法。

<Window x:Class="GridSplitter.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Window1" Height="400" Width="400">
    <Grid x:Name="LayoutRoot" Background="White" Width="400"  Height="400">
        <Grid.RowDefinitions>
            <RowDefinition MaxHeight="300" MinHeight="100" />
            <RowDefinition />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition MaxWidth="300" MinWidth="100" />
            <ColumnDefinition />
        </Grid.ColumnDefinitions>
        <Rectangle Fill="White" Grid.Row="0" Grid.Column="0" />
        <Rectangle Fill="Black" Grid.Row="0" Grid.Column="1" />
        <Rectangle Fill="Black" Grid.Row="1" Grid.Column="0" />
        <Rectangle Fill="White" Grid.Row="1" Grid.Column="1" />
        <GridSplitter Grid.Row="1" Grid.ColumnSpan="2" HorizontalAlignment="Stretch"  VerticalAlignment="Top" Background="Blue" Height="3" />
        <GridSplitter Grid.Column="1" Grid.RowSpan="2" HorizontalAlignment="Left"  VerticalAlignment="Stretch" Background="Blue" Width="3" />
    </Grid>
</Window>

运行结果:
这里写图片描述

说明:可通过移动中间的蓝色部分的线条改变四个区域的大小。

参考资料:http://www.cnblogs.com/wsdj-ITtech/archive/2009/07/26/1531207.html

版权声明:本文为博主原创文章,未经博主允许不得转载。

posted @ 2015-08-24 16:47  贱贱的梦想  阅读(2129)  评论(0编辑  收藏  举报