use*_*605 3 expander silverlight-toolkit windows-phone-7
我使用的是WindowsPhone Toolkit的ExpanderView,在第一次加载时,扩展的Expander总是看起来像第二张图片.看起来,它始终处于所有物品的同一高度.
如果我转到另一页并返回,一切都会很好,布局看起来很安静 - 除了停止扩展器的行(图1).
this.UpdatedLayout();(当前页面)或ExpanderView.UpdateLayout(); 解决了什么.未显示的项目已在该列表中完全加载.


<ItemsControl ItemsSource="{Binding EpisodeList}" Margin="20,0,0,0" Grid.Row="1" Grid.ColumnSpan="2">
<ItemsControl.ItemTemplate>
<DataTemplate>
<StackPanel>
<toolkit:ExpanderView ItemsSource="{Binding Value}" >
<toolkit:ExpanderView.Header>
<TextBlock Margin="0,0,10,0">
<Run Text="Season "/>
<Run Text="{Binding Key}" />
</TextBlock>
</toolkit:ExpanderView.Header>
<toolkit:ExpanderView.ItemTemplate>
<DataTemplate>
<Border BorderBrush="White" BorderThickness="1" Margin="5">
<Grid MouseLeftButtonUp="Grid_MouseLeftButtonUp">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Image Height="40" Source="{Binding ScreenCap}" Margin="5,0,0,0"/>
<TextBlock x:Name="t" Margin="10" Text="{Binding Title}" TextWrapping="Wrap" Grid.Column="1" />
</Grid>
</Border>
</DataTemplate>
</toolkit:ExpanderView.ItemTemplate>
</toolkit:ExpanderView>
</StackPanel>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
Run Code Online (Sandbox Code Playgroud)
EpisodeList是Dictionary(int,ObservableCollection(myClass))的类型,并实现了INotifyPropertyChanged
如果有人有任何计划在这里出错,我真的很感激你的帮助,我只是没有在谷歌上找到任何bug报告,也没有类似的Bug.
(在设备和仿真器上调试)
我设法通过使用列表框作为itemcontainer并将扩展器项绑定到它来解决这个问题:
<Controls:ExpanderView Expanded="ExpanderView_Expanded"
Header="{Binding}"
HeaderTemplate="{StaticResource HeaderTemplate}"
NonExpandableHeader="{Binding}"
ExpanderTemplate="{StaticResource ExpanderTemplate}"
NonExpandableHeaderTemplate="{StaticResource NonExpandableHeaderTemplate}"
Expander="{Binding}"
>
<ListBox ScrollViewer.VerticalScrollBarVisibility="Disabled" ItemTemplate="{StaticResource ItemTemplate}" ItemsSource="{Binding Items}" />
</Controls:ExpanderView>
Run Code Online (Sandbox Code Playgroud)