none
Silverlight5:4008错误-检测到布局循环,布局未能完成。(发生条件:在xaml的页面中,当ListBox绑定了一个List数据,当List数据比较多时) RRS feed

  • 问题

  • 如下代码的第20行绑定了一个list数据,当该list数据达到100条时,就会发生“4008错误-检测到布局循环”,数据源list中只有10条数据时就不会有这个问题。如果第20行不绑定数据也不会发生错误。第23行为自定义控件,其内绑定了list中的数据。

    请问如何能避免弹出4008错误。

    1  <sdk:TabControl Grid.Row="3" Name="xxxxTabControl" Background="#E7EFFF" MouseWheel="TabControl_MouseWheel">
    2      <i:Interaction.Triggers>
    3          <i:EventTrigger EventName="SelectionChanged">
    4              <i:InvokeCommandAction Command="{Binding xxxCommand}" />
    5          </i:EventTrigger>
    6      </i:Interaction.Triggers>
    7      <sdk:TabItem Header="XXXX" Name="tabBaseInfo" FontSize="16" Visibility="{Binding visBasicTab,Mode=TwoWay}" IsSelected="{Binding baseTabFlag,Mode=TwoWay}">
    8          <Grid toolkit:DockPanel.Dock="Top">
    9          <ScrollViewer x:Name="xxBaseInfo" VerticalScrollBarVisibility="Auto" BorderThickness="0" Margin="10,0,0,10" Padding="0" Background="#E7EFFF">
    10              <toolkit:DockPanel x:Name="dpBasicInfo">
    11                  <Grid>
    12                      <toolkit:DockPanel Grid.Row="2" x:Name="DpTwiceUse">
    13                          <toolkit:DockPanel FlowDirection="LeftToRight">
    14                              <Border x:Name="twiceUseTitleBorder" Style="{StaticResource OrangeBorderStyle}">
    15                                  <Grid>
    16                                      <toolkit:DockPanel Margin="10" Grid.Row="2" Grid.ColumnSpan="2">
    17                                          <toolkit:DockPanel  Margin="0,20,0,0">
    18                                              <Grid>
    19                                                  <Border Style="{StaticResource SecondHeadBorderStyle}" x:Name="vedioGramDistributionEtcBackground" Grid.Column="0" Grid.Row="1">
    20                                                      <ListBox x:Name="lbVideoDeliveryEtc" Background="{Binding xxxxListBox,Mode=TwoWay}" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ItemContainerStyle="{StaticResource ListBoxItemStyle}" ItemsSource="{Binding xxxList,Mode=TwoWay}" >
    21                                                          <ListBox.ItemTemplate>
    22                                                              <DataTemplate>
    23                                                                  <my:XXXModule Loaded="XXXModule_Loaded" />
    24                                                              </DataTemplate>
    25                                                          </ListBox.ItemTemplate>
    26                                                      </ListBox>
    27                                                  </Border>
    28                                              </Grid>
    29                                          </toolkit:DockPanel>
    30                                      </toolkit:DockPanel>
    31                                  </Grid>
    32                              </Border>
    33                          </toolkit:DockPanel>
    34                      </toolkit:DockPanel>
    35                  </Grid>
    36              </toolkit:DockPanel>
    37          </ScrollViewer>
    38          <toolkit:DockPanel VerticalAlignment="Top" Margin="0,0,18,0" HorizontalAlignment="Right" >
    39              <my:BaseInforTemplateControl  x:Name="mBaseInforTemplate"/>
    40          </toolkit:DockPanel>
    41          </Grid>
    42      </sdk:TabItem>
    43  </sdk:TabControl>

    2013年8月29日 6:37