0

我有一个页面,这里是 XAML。认为窗口有一个 TabControl ,我创建了一个选项卡 -> 框架 -> 页面。问题是最后两个DataGrids的高度比页面高度还高!任何帮助表示赞赏!谢谢。

<Page x:Class="pObjectDesigner"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
      xmlns:local="clr-namespace:STUDIO_MANAGER_FRAMEWORK"
      mc:Ignorable="d" x:Name="pObjectDesigner"
      d:DesignHeight="750" d:DesignWidth="1050" MinWidth="500"
      Title="pObjectDesigner">
    <Grid x:Name="MainGrid">
        <Grid.RowDefinitions>
            <RowDefinition Height="50"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <local:ucMXMainToolBar Grid.Row="0" Allow_GoLeft="False" Allow_GoRight="False" x:Name="tlbToolBar" VerticalAlignment="Top" />

        <Grid Grid.Row="1">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="250" MinWidth="180"/>
                <ColumnDefinition Width="5"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>

            <TreeView x:Name="tlstObjects"
                      HorizontalContentAlignment="Stretch" 
                      VerticalContentAlignment="Stretch"/>

            <GridSplitter Grid.Column="1" HorizontalAlignment="Stretch"/>

            <Grid Grid.Column="2">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="5"/>
                    <RowDefinition Height="*"/>
                </Grid.RowDefinitions>

                <DataGrid Grid.Row="0" x:Name="grdPages"
                          AutoGenerateColumns="True" 
                          ColumnWidth="Auto"
                          VerticalContentAlignment="Stretch"
                          HorizontalContentAlignment="Stretch" 
                          CanUserReorderColumns="True" />

                <GridSplitter Grid.Row="1" HorizontalAlignment="Stretch"/>

                <Grid Grid.Row="2">
                    <Grid.ColumnDefinitions >
                        <ColumnDefinition Width="0.5*" MinWidth="150" />
                        <ColumnDefinition Width="5"/>
                        <ColumnDefinition Width="0.5*" MinWidth="150"/>
                    </Grid.ColumnDefinitions>

                    <DataGrid Grid.Column="0" x:Name="grdDataGrids"
                            AutoGenerateColumns="True"
                            ColumnWidth="Auto"
                            VerticalContentAlignment="Stretch"
                            HorizontalContentAlignment="Stretch" 
                            CanUserReorderColumns="True"/>

                    <GridSplitter Grid.Column="1" HorizontalAlignment="Stretch"/>

                    <DataGrid Grid.Column="2" x:Name="grdModules"
                            AutoGenerateColumns="True"
                            ColumnWidth="Auto"
                            VerticalContentAlignment="Stretch"
                            HorizontalContentAlignment="Stretch" 
                            CanUserReorderColumns="True"/>

                </Grid>
            </Grid>
        </Grid>
    </Grid>
</Page>

快照

4

1 回答 1

0

您好在 DataGrid 中使用 AttachedProperty ScrollViewer.VerticalScrollBarVisibility 到 Auto

<DataGrid **ScrollViewer.VerticalScrollBarVisibility="Auto"**

同样,您可以将其设置为水平。我希望这会有所帮助。

于 2013-07-28T14:44:19.783 回答