带网格分离器的Silverlight数据网格

时间:2011-10-13 16:59:10

标签: c# wpf vb.net silverlight

我有下面的代码,我试图在中间有两个带有网格分割器的数据网格。分裂似乎工作正常,但我遇到的问题是当我填充数据网格时,它正在增加高度并改变分割器而不是单独留下高度并添加滚动条。

我忽略了什么简单的事情?

   <Grid x:Name="gdHistory" Grid.Column="0" Grid.Row="2" >
                    <Grid.RowDefinitions>
                        <RowDefinition Height="*"/>
                        <RowDefinition Height="*"/>
                    </Grid.RowDefinitions>
                    <ig:XamGrid Grid.Row="0" ItemsSource="{Binding Path=PendingRequests}" Margin="10,10,10,15" AutoGenerateColumns="False" Visibility="Visible">
                        <ig:XamGrid.Columns>
                            <ig:UnboundColumn Key="Delete" IsFilterable="False" IsGroupable="False" IsMovable="False" IsResizable="False" IsSummable="False">
                                <ig:UnboundColumn.ItemTemplate>
                                    <DataTemplate>
                                        <Button x:Name="cmdDelete" Content="Delete" Height="20" Click="DeleteReqMethod"/>
                                    </DataTemplate>
                                </ig:UnboundColumn.ItemTemplate>
                            </ig:UnboundColumn>
                            <ig:TextColumn AllowCaseSensitiveSort="True" EditorHorizontalContentAlignment="Stretch" EditorVerticalContentAlignment="Stretch" FixedIndicatorDirection="{x:Null}" HeaderText="Part Id" IsFilterable="True" IsFixable="True" IsGroupable="True" IsHideable="True" IsMovable="True" IsResizable="True" IsSortable="True" IsSummable="True" Key="Part_Id" VerticalContentAlignment="Center">
                                <ig:TextColumn.FilterColumnSettings>
                                    <ig:FilterColumnSettings FilterCaseSensitive="False" FilterCellValue="{x:Null}" FilterMenuClearFiltersString="{x:Null}" FilterMenuTypeSpecificFiltersString="{x:Null}" FilteringOperand="{x:Null}" />
                                </ig:TextColumn.FilterColumnSettings>
                                <ig:TextColumn.SummaryColumnSettings>
                                    <ig:SummaryColumnSettings />
                                </ig:TextColumn.SummaryColumnSettings>
                            </ig:TextColumn>
                            <ig:TextColumn AllowCaseSensitiveSort="True" EditorHorizontalContentAlignment="Stretch" EditorVerticalContentAlignment="Stretch" FixedIndicatorDirection="{x:Null}" HeaderText="Rev" IsFilterable="True" IsFixable="True" IsGroupable="True" IsHideable="True" IsMovable="True" IsResizable="True" IsSortable="True" IsSummable="True" Key="Part_Rev" VerticalContentAlignment="Center">
                                <ig:TextColumn.FilterColumnSettings>
                                    <ig:FilterColumnSettings FilterCaseSensitive="False" FilterCellValue="{x:Null}" FilterMenuClearFiltersString="{x:Null}" FilterMenuTypeSpecificFiltersString="{x:Null}" FilteringOperand="{x:Null}" />
                                </ig:TextColumn.FilterColumnSettings>
                                <ig:TextColumn.SummaryColumnSettings>
                                    <ig:SummaryColumnSettings />
                                </ig:TextColumn.SummaryColumnSettings>
                            </ig:TextColumn>
                            <ig:TextColumn AllowCaseSensitiveSort="True" EditorHorizontalContentAlignment="Stretch" EditorVerticalContentAlignment="Stretch" FixedIndicatorDirection="{x:Null}" HeaderText="Desc" IsFilterable="True" IsFixable="True" IsGroupable="True" IsHideable="True" IsMovable="True" IsResizable="True" IsSortable="True" IsSummable="True" Key="Part_Desc" VerticalContentAlignment="Center">
                                <ig:TextColumn.FilterColumnSettings>
                                    <ig:FilterColumnSettings FilterCaseSensitive="False" FilterCellValue="{x:Null}" FilterMenuClearFiltersString="{x:Null}" FilterMenuTypeSpecificFiltersString="{x:Null}" FilteringOperand="{x:Null}" />
                                </ig:TextColumn.FilterColumnSettings>
                                <ig:TextColumn.SummaryColumnSettings>
                                    <ig:SummaryColumnSettings />
                                </ig:TextColumn.SummaryColumnSettings>
                            </ig:TextColumn>
                            <ig:TextColumn AllowCaseSensitiveSort="True" EditorHorizontalContentAlignment="Stretch" EditorVerticalContentAlignment="Stretch" FixedIndicatorDirection="{x:Null}" HeaderText="Qty" IsFilterable="True" IsFixable="True" IsGroupable="True" IsHideable="True" IsMovable="True" IsResizable="True" IsSortable="True" IsSummable="True" Key="ReqQty" VerticalContentAlignment="Center">
                                <ig:TextColumn.FilterColumnSettings>
                                    <ig:FilterColumnSettings FilterCaseSensitive="False" FilterCellValue="{x:Null}" FilterMenuClearFiltersString="{x:Null}" FilterMenuTypeSpecificFiltersString="{x:Null}" FilteringOperand="{x:Null}" />
                                </ig:TextColumn.FilterColumnSettings>
                                <ig:TextColumn.SummaryColumnSettings>
                                    <ig:SummaryColumnSettings />
                                </ig:TextColumn.SummaryColumnSettings>
                            </ig:TextColumn>
                            <ig:TextColumn AllowCaseSensitiveSort="True" EditorHorizontalContentAlignment="Stretch" EditorVerticalContentAlignment="Stretch" FixedIndicatorDirection="{x:Null}" HeaderText="UOM" IsFilterable="True" IsFixable="True" IsGroupable="True" IsHideable="True" IsMovable="True" IsResizable="True" IsSortable="True" IsSummable="True" Key="UOM" VerticalContentAlignment="Center">
                                <ig:TextColumn.FilterColumnSettings>
                                    <ig:FilterColumnSettings FilterCaseSensitive="False" FilterCellValue="{x:Null}" FilterMenuClearFiltersString="{x:Null}" FilterMenuTypeSpecificFiltersString="{x:Null}" FilteringOperand="{x:Null}" />
                                </ig:TextColumn.FilterColumnSettings>
                                <ig:TextColumn.SummaryColumnSettings>
                                    <ig:SummaryColumnSettings />
                                </ig:TextColumn.SummaryColumnSettings>
                            </ig:TextColumn>
                            <ig:TextColumn AllowCaseSensitiveSort="True" EditorHorizontalContentAlignment="Stretch" EditorVerticalContentAlignment="Stretch" FixedIndicatorDirection="{x:Null}" HeaderText="Find No" IsFilterable="True" IsFixable="True" IsGroupable="True" IsHideable="True" IsMovable="True" IsResizable="True" IsSortable="True" IsSummable="True" Key="FindNo" VerticalContentAlignment="Center">
                                <ig:TextColumn.FilterColumnSettings>
                                    <ig:FilterColumnSettings FilterCaseSensitive="False" FilterCellValue="{x:Null}" FilterMenuClearFiltersString="{x:Null}" FilterMenuTypeSpecificFiltersString="{x:Null}" FilteringOperand="{x:Null}" />
                                </ig:TextColumn.FilterColumnSettings>
                                <ig:TextColumn.SummaryColumnSettings>
                                    <ig:SummaryColumnSettings />
                                </ig:TextColumn.SummaryColumnSettings>
                            </ig:TextColumn>


                            <ig:TextColumn AllowCaseSensitiveSort="True" EditorHorizontalContentAlignment="Stretch" EditorVerticalContentAlignment="Stretch" FixedIndicatorDirection="{x:Null}" HeaderText="Location" IsFilterable="True" IsFixable="True" IsGroupable="True" IsHideable="True" IsMovable="True" IsResizable="True" IsSortable="True" IsSummable="True" Key="Location" VerticalContentAlignment="Center">
                                <ig:TextColumn.FilterColumnSettings>
                                    <ig:FilterColumnSettings FilterCaseSensitive="False" FilterCellValue="{x:Null}" FilterMenuClearFiltersString="{x:Null}" FilterMenuTypeSpecificFiltersString="{x:Null}" FilteringOperand="{x:Null}" />
                                </ig:TextColumn.FilterColumnSettings>
                                <ig:TextColumn.SummaryColumnSettings>
                                    <ig:SummaryColumnSettings />
                                </ig:TextColumn.SummaryColumnSettings>
                            </ig:TextColumn>
                            <ig:TextColumn AllowCaseSensitiveSort="True" EditorHorizontalContentAlignment="Stretch" EditorVerticalContentAlignment="Stretch" FixedIndicatorDirection="{x:Null}" HeaderText="Src Tag" IsFilterable="True" IsFixable="True" IsGroupable="True" IsHideable="True" IsMovable="True" IsResizable="True" IsSortable="True" IsSummable="True" Key="SrcTag" VerticalContentAlignment="Center">
                                <ig:TextColumn.FilterColumnSettings>
                                    <ig:FilterColumnSettings FilterCaseSensitive="False" FilterCellValue="{x:Null}" FilterMenuClearFiltersString="{x:Null}" FilterMenuTypeSpecificFiltersString="{x:Null}" FilteringOperand="{x:Null}" />
                                </ig:TextColumn.FilterColumnSettings>
                                <ig:TextColumn.SummaryColumnSettings>
                                    <ig:SummaryColumnSettings />
                                </ig:TextColumn.SummaryColumnSettings>
                            </ig:TextColumn>




                        </ig:XamGrid.Columns>
                    </ig:XamGrid>

                    <sdk:GridSplitter Margin="10,5" Grid.Row="0" Height="10" HorizontalAlignment="Stretch" VerticalAlignment="Bottom" />
                    <TextBlock Grid.Row="3" Text="Issue Item History" Foreground="#FF617583" FontWeight="Bold" HorizontalAlignment="Center" Margin="0,10,0,0" />
                    <ig:XamGrid ItemsSource="{Binding Path=MoReq_7000}" Margin="10" Grid.Row="4" IsAlternateRowsEnabled="False" AutoGenerateColumns="False" Name="xg_moreq_7000" Visibility="Visible" >
                        <ig:XamGrid.RowSelectorSettings>
                            <ig:RowSelectorSettings Visibility="Visible" />
                        </ig:XamGrid.RowSelectorSettings>
                        <ig:XamGrid.ClipboardSettings>
                            <ig:ClipboardSettings AllowCopy="True" CopyOptions="ExcludeHeaders" CopyType="SelectedCells" />
                        </ig:XamGrid.ClipboardSettings>
                        <ig:XamGrid.Columns>
                            <ig:TextColumn AllowCaseSensitiveSort="True" EditorHorizontalContentAlignment="Stretch" EditorVerticalContentAlignment="Stretch" FixedIndicatorDirection="{x:Null}" HeaderText="LN NO" IsFilterable="True" IsFixable="True" IsGroupable="True" IsHideable="True" IsMovable="True" IsResizable="True" IsSortable="True" IsSummable="True" Key="COMP_LN_NO" VerticalContentAlignment="Center">
                                <ig:TextColumn.FilterColumnSettings>
                                    <ig:FilterColumnSettings FilterCaseSensitive="False" FilterCellValue="{x:Null}" FilterMenuClearFiltersString="{x:Null}" FilterMenuTypeSpecificFiltersString="{x:Null}" FilteringOperand="{x:Null}" />
                                </ig:TextColumn.FilterColumnSettings>
                                <ig:TextColumn.SummaryColumnSettings>
                                    <ig:SummaryColumnSettings />
                                </ig:TextColumn.SummaryColumnSettings>
                            </ig:TextColumn>
                            <ig:TextColumn AllowCaseSensitiveSort="True" EditorHorizontalContentAlignment="Stretch" EditorVerticalContentAlignment="Stretch" FixedIndicatorDirection="{x:Null}" HeaderText="FIND ID" IsFilterable="True" IsFixable="True" IsGroupable="True" IsHideable="True" IsMovable="True" IsResizable="True" IsSortable="True" IsSummable="True" Key="COMP_FIND_ID" VerticalContentAlignment="Center">
                                <ig:TextColumn.FilterColumnSettings>
                                    <ig:FilterColumnSettings FilterCaseSensitive="False" FilterCellValue="{x:Null}" FilterMenuClearFiltersString="{x:Null}" FilterMenuTypeSpecificFiltersString="{x:Null}" FilteringOperand="{x:Null}" />
                                </ig:TextColumn.FilterColumnSettings>
                                <ig:TextColumn.SummaryColumnSettings>
                                    <ig:SummaryColumnSettings />
                                </ig:TextColumn.SummaryColumnSettings>
                            </ig:TextColumn>
                            <ig:TextColumn AllowCaseSensitiveSort="True" EditorHorizontalContentAlignment="Stretch" EditorVerticalContentAlignment="Stretch" FixedIndicatorDirection="{x:Null}" HeaderText="PART ID" IsFilterable="True" IsFixable="True" IsGroupable="True" IsHideable="True" IsMovable="True" IsResizable="True" IsSortable="True" IsSummable="True" Key="COMP_PART_ID" VerticalContentAlignment="Center">
                                <ig:TextColumn.FilterColumnSettings>
                                    <ig:FilterColumnSettings FilterCaseSensitive="False" FilterCellValue="{x:Null}" FilterMenuClearFiltersString="{x:Null}" FilterMenuTypeSpecificFiltersString="{x:Null}" FilteringOperand="{x:Null}" />
                                </ig:TextColumn.FilterColumnSettings>
                                <ig:TextColumn.SummaryColumnSettings>
                                    <ig:SummaryColumnSettings />
                                </ig:TextColumn.SummaryColumnSettings>
                            </ig:TextColumn>
                            <ig:TextColumn AllowCaseSensitiveSort="True" EditorHorizontalContentAlignment="Stretch" EditorVerticalContentAlignment="Stretch" FixedIndicatorDirection="{x:Null}" HeaderText="REV" IsFilterable="True" IsFixable="True" IsGroupable="True" IsHideable="True" IsMovable="True" IsResizable="True" IsSortable="True" IsSummable="True" Key="COMP_PART_RVSN_ID" VerticalContentAlignment="Center">
                                <ig:TextColumn.FilterColumnSettings>
                                    <ig:FilterColumnSettings FilterCaseSensitive="False" FilterCellValue="{x:Null}" FilterMenuClearFiltersString="{x:Null}" FilterMenuTypeSpecificFiltersString="{x:Null}" FilteringOperand="{x:Null}" />
                                </ig:TextColumn.FilterColumnSettings>
                                <ig:TextColumn.SummaryColumnSettings>
                                    <ig:SummaryColumnSettings />
                                </ig:TextColumn.SummaryColumnSettings>
                            </ig:TextColumn>
                            <ig:TextColumn AllowCaseSensitiveSort="True" EditorHorizontalContentAlignment="Stretch" EditorVerticalContentAlignment="Stretch" FixedIndicatorDirection="{x:Null}" HeaderText="DESC" IsFilterable="True" IsFixable="True" IsGroupable="True" IsHideable="True" IsMovable="True" IsResizable="True" IsSortable="True" IsSummable="True" Key="ITEM_DESC" VerticalContentAlignment="Center">
                                <ig:TextColumn.FilterColumnSettings>
                                    <ig:FilterColumnSettings FilterCaseSensitive="False" FilterCellValue="{x:Null}" FilterMenuClearFiltersString="{x:Null}" FilterMenuTypeSpecificFiltersString="{x:Null}" FilteringOperand="{x:Null}" />
                                </ig:TextColumn.FilterColumnSettings>
                                <ig:TextColumn.SummaryColumnSettings>
                                    <ig:SummaryColumnSettings />
                                </ig:TextColumn.SummaryColumnSettings>
                            </ig:TextColumn>
                            <ig:TextColumn AllowCaseSensitiveSort="True" EditorHorizontalContentAlignment="Stretch" EditorVerticalContentAlignment="Stretch" FixedIndicatorDirection="{x:Null}" HeaderText="ABBRV" IsFilterable="True" IsFixable="True" IsGroupable="True" IsHideable="True" IsMovable="True" IsResizable="True" IsSortable="True" IsSummable="True" Key="INVT_ABBRV_CD" VerticalContentAlignment="Center">
                                <ig:TextColumn.FilterColumnSettings>
                                    <ig:FilterColumnSettings FilterCaseSensitive="False" FilterCellValue="{x:Null}" FilterMenuClearFiltersString="{x:Null}" FilterMenuTypeSpecificFiltersString="{x:Null}" FilteringOperand="{x:Null}" />
                                </ig:TextColumn.FilterColumnSettings>
                                <ig:TextColumn.SummaryColumnSettings>
                                    <ig:SummaryColumnSettings />
                                </ig:TextColumn.SummaryColumnSettings>
                            </ig:TextColumn>
                            <ig:TextColumn AllowCaseSensitiveSort="True" EditorHorizontalContentAlignment="Stretch" EditorVerticalContentAlignment="Stretch" FixedIndicatorDirection="{x:Null}" HeaderText="REQD QTY" IsFilterable="True" IsFixable="True" IsGroupable="True" IsHideable="True" IsMovable="True" IsResizable="True" IsSortable="True" IsSummable="True" Key="REQD_QTY" VerticalContentAlignment="Center">
                                <ig:TextColumn.FilterColumnSettings>
                                    <ig:FilterColumnSettings FilterCaseSensitive="False" FilterCellValue="{x:Null}" FilterMenuClearFiltersString="{x:Null}" FilterMenuTypeSpecificFiltersString="{x:Null}" FilteringOperand="{x:Null}" />
                                </ig:TextColumn.FilterColumnSettings>
                                <ig:TextColumn.SummaryColumnSettings>
                                    <ig:SummaryColumnSettings />
                                </ig:TextColumn.SummaryColumnSettings>
                            </ig:TextColumn>
                            <ig:TextColumn AllowCaseSensitiveSort="True" EditorHorizontalContentAlignment="Stretch" EditorVerticalContentAlignment="Stretch" FixedIndicatorDirection="{x:Null}" HeaderText="TO ISSUE QTY" IsFilterable="True" IsFixable="True" IsGroupable="True" IsHideable="True" IsMovable="True" IsResizable="True" IsSortable="True" IsSummable="True" Key="TO_ISSUE_QTY" VerticalContentAlignment="Center">
                                <ig:TextColumn.FilterColumnSettings>
                                    <ig:FilterColumnSettings FilterCaseSensitive="False" FilterCellValue="{x:Null}" FilterMenuClearFiltersString="{x:Null}" FilterMenuTypeSpecificFiltersString="{x:Null}" FilteringOperand="{x:Null}" />
                                </ig:TextColumn.FilterColumnSettings>
                                <ig:TextColumn.SummaryColumnSettings>
                                    <ig:SummaryColumnSettings />
                                </ig:TextColumn.SummaryColumnSettings>
                            </ig:TextColumn>
                            <ig:TextColumn AllowCaseSensitiveSort="True" EditorHorizontalContentAlignment="Stretch" EditorVerticalContentAlignment="Stretch" FixedIndicatorDirection="{x:Null}" HeaderText="ISSUED QTY" IsFilterable="True" IsFixable="True" IsGroupable="True" IsHideable="True" IsMovable="True" IsResizable="True" IsSortable="True" IsSummable="True" Key="ISSUED_QTY" VerticalContentAlignment="Center">
                                <ig:TextColumn.FilterColumnSettings>
                                    <ig:FilterColumnSettings FilterCaseSensitive="False" FilterCellValue="{x:Null}" FilterMenuClearFiltersString="{x:Null}" FilterMenuTypeSpecificFiltersString="{x:Null}" FilteringOperand="{x:Null}" />
                                </ig:TextColumn.FilterColumnSettings>
                                <ig:TextColumn.SummaryColumnSettings>
                                    <ig:SummaryColumnSettings />
                                </ig:TextColumn.SummaryColumnSettings>
                            </ig:TextColumn>
                            <ig:TextColumn AllowCaseSensitiveSort="True" EditorHorizontalContentAlignment="Stretch" EditorVerticalContentAlignment="Stretch" FixedIndicatorDirection="{x:Null}" HeaderText="RESVD QTY" IsFilterable="True" IsFixable="True" IsGroupable="True" IsHideable="True" IsMovable="True" IsResizable="True" IsSortable="True" IsSummable="True" Key="INV_RESVD_QTY" VerticalContentAlignment="Center">
                                <ig:TextColumn.FilterColumnSettings>
                                    <ig:FilterColumnSettings FilterCaseSensitive="False" FilterCellValue="{x:Null}" FilterMenuClearFiltersString="{x:Null}" FilterMenuTypeSpecificFiltersString="{x:Null}" FilteringOperand="{x:Null}" />
                                </ig:TextColumn.FilterColumnSettings>
                                <ig:TextColumn.SummaryColumnSettings>
                                    <ig:SummaryColumnSettings />
                                </ig:TextColumn.SummaryColumnSettings>
                            </ig:TextColumn>
                        </ig:XamGrid.Columns>
                    </ig:XamGrid>
                </Grid>

1 个答案:

答案 0 :(得分:2)

尝试为拆分器添加另一行并将其高度设置为auto:

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

第一行数据网格的第0行 第1行为分离器。
第二行数据网格的第2行。

将拆分器对齐设置为stretch

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

这是我测试的完整XAML:

<Grid x:Name="LayoutRoot">
        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <sdk:DataGrid/>                    
        <sdk:GridSplitter Grid.Row="1" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"/>
        <sdk:DataGrid Grid.Row="2"/>
    </Grid>