嵌套的滚动条仅部分可见

时间:2017-01-20 11:35:11

标签: wpf xaml devexpress

我无法弄清楚如何为嵌套的ScrollViewer控件提供空间。

enter image description here

我有Border嵌套ScrollViewer,其中包含ListView模板,可以呈现多个DevExpress GridControl控件。

我尝试过添加填充,边距等似乎无法正常工作。

这个网格允许我添加多个StackPanel,因为它们在不同的点可见。我已经删除了简洁的代码。

        <Border BorderThickness="4" Grid.Column="0" Grid.Row="2">
        <ScrollViewer VerticalScrollBarVisibility="Auto" Width="450" MinHeight="200" MaxHeight="600">
            <Grid>
                <StackPanel HorizontalAlignment="Center">
                    <ListView ItemsSource="{Binding FilterItemLists}"  ScrollViewer.HorizontalScrollBarVisibility="Disabled" view:MarginSetter.Margin="5">
                        <ListView.ItemsPanel>
                            <ItemsPanelTemplate>
                                <WrapPanel Orientation="Horizontal"></WrapPanel>
                            </ItemsPanelTemplate>
                        </ListView.ItemsPanel>
                        <ListView.ItemTemplate>
                            <DataTemplate>
                                <StackPanel Orientation="Vertical" Width="200">
                                    <dxlc:LayoutItem VerticalAlignment="Stretch" Padding="4">
                                        <Label Content="{Binding Title}"/>
                                    </dxlc:LayoutItem>
                                    <dxlc:LayoutItem VerticalAlignment="Stretch" Padding="4" Height="200" >
                                        <dxg:GridControl ItemsSource="{Binding Path=Items, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" 
                                             AutoGenerateColumns="None" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                                            <dxg:GridControl.Columns>
                                                <dxg:GridColumn FieldName="IsSelected" Width="20" FixedWidth="True" Fixed="Left">
                                                    <dxg:GridColumn.CellTemplate>
                                                        <DataTemplate>
                                                            <dxe:CheckEdit MaxWidth="20" IsChecked="{Binding RelativeSource={RelativeSource TemplatedParent},
                                                                    Path=DataContext.RowData.Row.IsSelected, Mode=TwoWay}"
                                                                   Command="{Binding RelativeSource={RelativeSource AncestorType={x:Type dxg:GridControl}}, Path=DataContext.FilterItemSelectedCommand}"
                                                                       CommandParameter="{Binding Path=RowData.Row}"
                                                          HorizontalAlignment="Center" VerticalAlignment="Center">
                                                            </dxe:CheckEdit>
                                                        </DataTemplate>
                                                    </dxg:GridColumn.CellTemplate>
                                                </dxg:GridColumn>
                                                <dxg:GridColumn FieldName="Name" BestFitMode="AllRows"/>
                                            </dxg:GridControl.Columns>
                                            <dxg:GridControl.View>
                                                <dxg:TableView AllowEditing="False" AutoWidth="True" ShowBandsInCustomizationForm="False" ShowBandsPanel="False" 
                                                   ShowColumnHeaders="False" ShowGroupPanel="False" ShowIndicator="False" ShowSearchPanelCloseButton="False"
                                                   ShowVerticalLines="False" ShowHorizontalLines="False"/>
                                            </dxg:GridControl.View>
                                        </dxg:GridControl>
                                    </dxlc:LayoutItem>
                                </StackPanel>
                            </DataTemplate>
                        </ListView.ItemTemplate>
                    </ListView>
                </StackPanel>
            </Grid>
        </ScrollViewer>
    </Border>

0 个答案:

没有答案