我有两个行和GridSplitter的网格。 在第一行我有有DataPager的和DataGrid中有一个StackPanel中。 在第二行中我有膨胀机控制垂直底对齐和展开方向上向上。 有观点认为,数据网格将占据所有空间(垂直拉伸)都行,但是当扩展报头被点击,它就会向上拓展和DataGrid会自动收缩。
但是,这没有发生。 当我点击的扩展,它扩大,但页面大小的增加,而不是数据网格(行0)收缩向上。 任何人都知道我怎样才能做到这一点? 我的代码如下所示。 我已经把ScrollViewers在DataGrid的水平,StackPanel中的级别,而且电网水平太多,但没有成功尝试。
<Grid x:Name="contentGrid" HorizontalAlignment="Stretch" Grid.Column="1">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition/>
</Grid.RowDefinitions>
<tools:GridSplitter x:Name="rowSplitter" Grid.Row="1" VerticalAlignment="Top" HorizontalAlignment="Stretch"/>
<ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
<StackPanel Grid.Row="0" Orientation="Vertical" VerticalAlignment="Stretch" >
<StackPanel Orientation="Horizontal" Width="auto" Height="30">
<TextBlock Text="Search" Margin="20,10,0,0" TextAlignment="Center" VerticalAlignment="Center" Height="25"/>
<TextBox Width="200" Margin="5,0,0,0" x:Name="txtSearch" Height="25"/>
<ComboBox x:Name="cboFilter" SelectedIndex="0" SelectedValuePath="Name" VerticalAlignment="Center" Height="25">
<ComboBoxItem Name="Code">Line No</ComboBoxItem>
<ComboBoxItem Name="Description1">Heading</ComboBoxItem>
<ComboBoxItem Name="Description2">Happy Text</ComboBoxItem>
<ComboBoxItem Name="PromotionType">Promotion Type</ComboBoxItem>
</ComboBox>
<CheckBox x:Name="chkIsGrouping" Margin="10,5,0,0" Content="Enable Grouping" Checked="chkIsGrouping_Checked"/>
</StackPanel>
<sdk:DataPager Height="25" Name="dataPager1" Source="{Binding ElementName=productDomainDataSource, Path=Data}" />
<sdk:DataGrid AutoGenerateColumns="False" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" HorizontalAlignment="Stretch" ItemsSource="{Binding ElementName=productDomainDataSource, Path=Data}" Name="productDataGrid" RowDetailsVisibilityMode="VisibleWhenSelected" VerticalAlignment="Top" SelectionChanged="productDataGrid_SelectionChanged" >
<sdk:DataGrid.Columns>
<sdk:DataGridTextColumn x:Name="codeColumn" Binding="{Binding Path=Code}" Header="Code" Width="SizeToHeader" />
<sdk:DataGridTextColumn x:Name="description1Column" Binding="{Binding Path=Description1}" Header="Description 1" Width="SizeToHeader" />
<sdk:DataGridTextColumn x:Name="description2Column" Binding="{Binding Path=Description2}" Header="Description 2" Width="SizeToHeader" />
<sdk:DataGridTextColumn x:Name="productIDColumn" Binding="{Binding Path=ProductID, Mode=OneWay}" Header="Product ID" IsReadOnly="True" Width="SizeToHeader" Visibility="Collapsed" />
<sdk:DataGridTextColumn x:Name="promotionIDColumn" Binding="{Binding Path=PromotionID}" Header="Promotion ID" Width="SizeToHeader" Visibility="Collapsed"/>
<sdk:DataGridTextColumn x:Name="promotionTypeIDColumn" Binding="{Binding Path=PromotionTypeID}" Header="Promotion Type ID" Width="SizeToHeader" Visibility="Collapsed" />
<sdk:DataGridTextColumn x:Name="retailPriceColumn" Binding="{Binding Path=RetailPrice}" Header="Retail Price" Width="SizeToHeader" />
<sdk:DataGridTextColumn x:Name="retailPriceUnitColumn" Binding="{Binding Path=RetailPriceUnit}" Header="Retail Price Unit" Width="SizeToHeader" />
<sdk:DataGridTextColumn x:Name="templateIDColumn" Binding="{Binding Path=TemplateID}" Header="Template ID" Width="SizeToHeader" />
<sdk:DataGridTextColumn x:Name="wasPriceColumn" Binding="{Binding Path=WasPrice}" Header="Was Price" Width="SizeToHeader" />
<sdk:DataGridTextColumn x:Name="wasPriceUnitColumn" Binding="{Binding Path=WasPriceUnit}" Header="Was Price Unit" Width="SizeToHeader" />
</sdk:DataGrid.Columns>
</sdk:DataGrid>
</StackPanel>
</ScrollViewer>
<expandertoolkit:Expander x:Name="Expander1" Margin="0,10,0,0" Grid.Row="1" VerticalAlignment="Bottom"
ExpandDirection="Up"
HeaderTemplate="{StaticResource DTHeader}"
ContentTemplate="{StaticResource DTContent}">
</expandertoolkit:Expander>
</Grid>