1. 程式人生 > >[WPF]拖拽改變區域大小

[WPF]拖拽改變區域大小

<Window x:Class="WPFTest.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="Auto" Width="Auto">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>
        <DockPanel Grid.Row="0" Grid.Column="0">
            <TreeView>
                <TreeViewItem Header="A00">
                    <TreeViewItem Header="A01"/>
                    <TreeViewItem Header="A02"/>
                    <TreeViewItem Header="A03"/>
                    <TreeViewItem Header="A04"/>
                </TreeViewItem>
                <TreeViewItem Header="B00">
                    <TreeViewItem Header="B01"/>
                    <TreeViewItem Header="B02"/>
                    <TreeViewItem Header="B03"/>
                    <TreeViewItem Header="B04"/>
                </TreeViewItem>
                <TreeViewItem Header="C00">
                    <TreeViewItem Header="C01"/>
                    <TreeViewItem Header="C02"/>
                    <TreeViewItem Header="C03"/>
                    <TreeViewItem Header="C04"/>
                </TreeViewItem>
                <TreeViewItem Header="D00">
                    <TreeViewItem Header="D01"/>
                    <TreeViewItem Header="D02"/>
                    <TreeViewItem Header="D03"/>
                    <TreeViewItem Header="D04"/>
                </TreeViewItem>
            </TreeView>
        </DockPanel>
        <GridSplitter Grid.Row="0" Grid.Column="1" Width="3" Margin="2,0,2,0" Background="Purple"
                      VerticalAlignment="Stretch" HorizontalAlignment="Center"/>
        <DockPanel Grid.Row="0" Grid.Column="2">
            <ListView>
                <ListViewItem>E00</ListViewItem>
                <ListViewItem>F00</ListViewItem>
                <ListViewItem>G00</ListViewItem>
                <ListViewItem>H00</ListViewItem>
                <ListViewItem>I00</ListViewItem>
                <ListViewItem>J00</ListViewItem>
                <ListViewItem>K00</ListViewItem>
                <ListViewItem>L00</ListViewItem>
            </ListView>
        </DockPanel>
    </Grid>
</Window>