众所周知,wp8中的LongListSelector集成到了Rom中。
性能得到了提升,一些api也发生了变化。
在这里总结一下,作为分享,也作为备忘。
参考文献 Windows Phone 8 XAML LongListSelector
1.首先能一眼看出来的,就是滑动时可以固定的,分组header了。
这个原来我们都是放一个textblock在那个位置,滑动时根据可视区域所在的项目,然后赋给textblock值。
现在省事多了。
2. 还有原来很费事才能实现的网格模式。现在通过layoutmode设置了。
3. 原来的分组模板变成了JumpListStyle,由模板变成了样式,刚开始这块弄得有点晕,这让编辑变得有些不方便了。
为了方便记录下编辑好的样式,以后直接拷贝就好了。
1 <phone:PhoneApplicationPage.Resources> 2 <phone: JumpListItemBackgroundConverter x:Key="BackgroundConverter"/> 3 <phone:JumpListItemForegroundConverter x:Key="ForegroundConverter"/> 4 5 <Style x:Key="JumpListStyle" TargetType="phone:LongListSelector"> 6 <Setter Property="LayoutMode" Value="List" /> 7 <Setter Property="Margin" Value="12,12,0,0"/> 8 <Setter Property="ItemTemplate"> 9 <Setter.Value> 10 <DataTemplate> 11 <Border Background="{Binding Converter={StaticResource BackgroundConverter}}" 12 Width="470" 13 Height="70" 14 Margin="6"> 15 <TextBlock Text="{Binding Key}" 16 Foreground="{Binding Converter= {StaticResource ForegroundConverter}}" 17 Font Family="{StaticResource PhoneFontFamilySemiBold}" 18 FontSize="28" 19 Padding="2" 20 VerticalAlignment="Bottom"/> 21 </Border> 22 </DataTemplate> 23 </Setter.Value> 24 </Setter> 25 </Style> 26 </phone:PhoneApplicationPage.Resources>