内部手风琴项目在外部手风琴中有太多项目时问题扩大

时间:2013-04-26 10:36:10

标签: silverlight

我使用accrodian使用xaml代码。基本上问题是我使用的是一个嵌套在另一个中的两个手风琴。两者都被ScrollViewer所取代。如果外面的手风琴中有超过14个项目,那么扩展内部手风琴是不可见的,意味着它会被扩展,但由于没有空间,它不可见。

                          - 一些代码              

<toolkit:AccordionItem x:Name="test2" Style="{StaticResource ContentEditorAccordionItemStyle}" Header="{Binding LogicBlock, Source={StaticResource ResourceString}}" HorizontalAlignment="Stretch">
    <ScrollViewer BorderBrush="Red" BorderThickness="2" Grid.Row="3" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" Style="{StaticResource ScrollViewerStyle}">
        <toolkit:Accordion Grid.Row="1"  x:Name="testnew" ItemsSource="{Binding DynamicContentBlocks.Source, Mode=TwoWay}" FontSize="10" BorderBrush="{x:Null}">
            <toolkit:Accordion.ItemTemplate>
                <DataTemplate>
                    <Grid Margin="6,0">
                        <TextBlock Style="{StaticResource DefaultTextBlockStyle}" Text="{Binding Name}" FontSize="10"/>
                    </Grid>
                </DataTemplate>
            </toolkit:Accordion.ItemTemplate>
            <toolkit:Accordion.ContentTemplate>
                <DataTemplate>
                    <ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" 
                            Style="{StaticResource ScrollViewerStyle}"> 
                        <ItemsControl ItemsSource="{Binding Blocks}">
                            <ItemsControl.ItemTemplate>
                                <DataTemplate>

                                    <Grid>
                                        <Grid.RowDefinitions>
                                            <RowDefinition Height="6"/>
                                            <RowDefinition/>
                                        </Grid.RowDefinitions>
                                        <CheckBox Grid.Row="1" x:Name="chkSelectItem" IsChecked="{Binding IsSelected, Mode=TwoWay}" 
                                    Style="{StaticResource DefaultCheckBoxStyle}" Content="{Binding Name}" FontSize="10" />
                                    </Grid>

                                </DataTemplate>
                            </ItemsControl.ItemTemplate>
                        </ItemsControl>
                    </ScrollViewer>
                </DataTemplate>
            </toolkit:Accordion.ContentTemplate>
        </toolkit:Accordion>
    </ScrollViewer>
</toolkit:AccordionItem>
<toolkit:AccordionItem x:Name="test3" Style="{StaticResource ContentEditorAccordionItemStyle}" Header="{Binding DataR, Source={StaticResource ResourceString}}" HorizontalAlignment="Stretch">
    <ScrollViewer Grid.Row="3" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" Style="{StaticResource ScrollViewerStyle}">
    -- some code
    </ScrollViewer>
</toolkit:AccordionItem>

2 个答案:

答案 0 :(得分:0)

这是Accordion和AccordionItem的一个问题,我用Expander控件取代了Accordion并解决了这个问题......

答案 1 :(得分:0)

请参阅以下代码:

<Accordion>
     <ScrollViewer>
          <Accordion>
          </Accordion>
     <ScrollViewer>
</Accordion>