我有一个页面,这里是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>
答案 0 :(得分:0)
您好在DataGrid中使用AttachedProperty ScrollViewer.VerticalScrollBarVisibility自动
<DataGrid **ScrollViewer.VerticalScrollBarVisibility="Auto"**
类似地,你可以将它设置为水平。我希望这会有所帮助。