首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 媒体动画 > CAD教程 >

关于wpf窗体里面的小窗口,可以拖动大小解决思路

2014-01-01 
关于wpf窗体里面的小窗口,可以拖动大小楼主的实训作业就是想把上图的TreeView做成可以拖动大小的下面是布

关于wpf窗体里面的小窗口,可以拖动大小

楼主的实训作业就是想把上图的
TreeView做成可以拖动大小的
下面是布局代码,有点长

<Window x:Class="CustomerManage.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="428" Width="525">
    <Grid>
        <Menu Height="26" VerticalAlignment="Top">
        </Menu>
        <TabControl Margin="0,30,0,0">
            <!--客户信息-->
            <TabItem Header="客户信息">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="100"/>
                        <ColumnDefinition/>
                    </Grid.ColumnDefinitions>
                    <Grid HorizontalAlignment="Center" VerticalAlignment="Top" Height="300" Margin="0,10,0,0">
                        <Grid.RowDefinitions>
                            <RowDefinition/>
                            <RowDefinition/>
                            <RowDefinition/>
                            <RowDefinition/>
                            <RowDefinition/>
                            <RowDefinition/>
                        </Grid.RowDefinitions>
                        <Button Content="添  加" Width="80" Margin="3,10,3,10" />
                        <Button Content="删  除" Grid.Row="1" Width="80" Margin="3,10,3,10" />
                        <Button Content="修  改" Grid.Row="2" Width="80" Margin="3,10,3,10" />
                        <Button Content="查  找" Grid.Row="3" Width="80" Margin="3,10,3,10" />
                        <Button Content="按部门显示" Grid.Row="4" Width="80" Margin="3,10,3,10" />
                        <Button Content="按公司显示" Grid.Row="5" Width="80" Margin="3,10,3,10" />
                        <Border BorderBrush="Silver" BorderThickness="2" Grid.RowSpan="6"/>
                    </Grid>
                    <DataGrid Grid.Column="1" Margin="2,10,2,2"/>
                </Grid>

            </TabItem>
            <!--员工信息-->


            <TabItem Header="员工信息">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="100"/>
                        <ColumnDefinition/>
                    </Grid.ColumnDefinitions>
                    <Grid HorizontalAlignment="Center" VerticalAlignment="Top" Height="200" Margin="0,10,0,0">
                        <Grid.RowDefinitions>
                            <RowDefinition/>
                            <RowDefinition/>
                            <RowDefinition/>
                            <RowDefinition/>
                        </Grid.RowDefinitions>
                        <Button Content="添  加" Width="80" Margin="3,10,3,10" />
                        <Button Content="删  除" Grid.Row="1" Width="80" Margin="3,10,3,10" />
                        <Button Content="修  改" Grid.Row="2" Width="80" Margin="3,10,3,10" />
                        <Button Content="查  找" Grid.Row="3" Width="80" Margin="3,10,3,10" />
                        <Border BorderBrush="Silver" BorderThickness="2" Grid.RowSpan="4"/>
                    </Grid>
                    <DataGrid Grid.Column="1" Margin="2,10,2,2"/>
                </Grid>
            </TabItem>
            <!--详细信息-->
            <TabItem Header="详细信息">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="100"/>
                        <ColumnDefinition/>
                    </Grid.ColumnDefinitions>
                    <!--
                    <Grid HorizontalAlignment="Center" VerticalAlignment="Top" Height="300" Margin="0,10,0,0">
                        <Grid.RowDefinitions>
                            <RowDefinition/>
                            <RowDefinition/>
                            <RowDefinition/>


                            <RowDefinition/>
                            <RowDefinition/>
                            <RowDefinition/>
                        </Grid.RowDefinitions>
                        <Button Content="添  加" Width="80" Margin="3,10,3,10" />
                        <Button Content="删  除" Grid.Row="1" Width="80" Margin="3,10,3,10" />
                        <Button Content="修  改" Grid.Row="2" Width="80" Margin="3,10,3,10" />
                        <Button Content="查  找" Grid.Row="3" Width="80" Margin="3,10,3,10" />
                        <Button Content="按部门显示" Grid.Row="4" Width="80" Margin="3,10,3,10" />
                        <Button Content="按公司显示" Grid.Row="5" Width="80" Margin="3,10,3,10" />
                        <Border BorderBrush="Silver" BorderThickness="2" Grid.RowSpan="6"/>
                    </Grid>
                    -->
                    <TreeView Margin="3,10,3,2">
                        <TreeViewItem Header="数据操作">
                            <TreeViewItem Header="添加"/>
                            <TreeViewItem Header="删除"/>
                            <TreeViewItem Header="修改"/>
                            <TreeViewItem Header="查找"/>
                        </TreeViewItem>
                        <TreeViewItem Header="显示">
                            <TreeViewItem Header="按部门显示"/>
                            <TreeViewItem Header="按单位显示"/>
                        </TreeViewItem>
                    </TreeView>
                    <GridSplitter Grid.Row="0" Grid.Column="0" 
                               Margin="0,0,0,0" HorizontalAlignment="Stretch" VerticalAlignment="Top"
                               ShowsPreview="True"
                                />
                    <DataGrid Grid.Column="1" Margin="2,10,2,2"/>


                </Grid>
            </TabItem>
        </TabControl>
    </Grid>
</Window>


[解决办法]
你搜搜“wpf docking”

热点排行