我正在使用这个 XAML:
<Border x:Name="border1" Grid.Row="1">
<toolkit:HeaderedContentControl Header="HeaderedContentControl" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" MaxWidth="{Binding ActualWidth, ElementName=border1}" MaxHeight="{Binding ActualHeight, ElementName=border1}">
<Grid HorizontalAlignment="Left">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition Height="32"/>
</Grid.RowDefinitions>
<ScrollViewer Grid.ColumnSpan="2" Margin="0" MinHeight="75" d:LayoutOverrides="Width, Height" ScrollViewer.VerticalScrollBarVisibility="Auto" Padding="0" ScrollViewer.HorizontalScrollBarVisibility="Auto" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch">
<sdk:DataGrid ItemsSource="{Binding ItemSummaries}">
</sdk:DataGrid>
</ScrollViewer>
<Button res:Strings.Assignment="Content=ItemsView.SaveButtonText" Grid.Row="1" Margin="5" Command="{Binding SaveCommand}" Grid.Column="1" d:LayoutOverrides="GridBox"/>
</Grid>
</toolkit:HeaderedContentControl>
</Border>
我的目标是防止 HeaderedContentControl 超出其包含的边框,我已经这样做了,但是一旦 DataGrid 超出其分配的空间,我希望它开始滚动。我已经尝试过使用或不使用父 ScrollViewer 的组合,Grid 超出了 HeaderedContentControl 的范围,并且没有出现滚动条。我到底在这里做错了什么?