您的位置:首页 > 其它

WPF中GridSplitter控件的使用

2015-08-24 16:47 162 查看
通过代码来理解 GridSplitter 的用法。

[code]<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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: