众所周知,wp8中的LongListSelector集成到了Rom中。

性能得到了提升,一些api也发生了变化。

在这里总结一下,作为分享,也作为备忘。

参考文献 Windows Phone 8 XAML LongListSelector

1.首先能一眼看出来的,就是滑动时可以固定的,分组header了。

这个原来我们都是放一个textblock在那个位置,滑动时根据可视区域所在的项目,然后赋给textblock值。
 现在省事多了。

2. 还有原来很费事才能实现的网格模式。现在通过layoutmode设置了。

3. 原来的分组模板变成了JumpListStyle,由模板变成了样式,刚开始这块弄得有点晕,这让编辑变得有些不方便了。
为了方便记录下编辑好的样式,以后直接拷贝就好了。

 <phone:PhoneApplicationPage.Resources>
<phone: JumpListItemBackgroundConverter x:Key="BackgroundConverter"/>
<phone:JumpListItemForegroundConverter x:Key="ForegroundConverter"/> <Style x:Key="JumpListStyle" TargetType="phone:LongListSelector">
<Setter Property="LayoutMode" Value="List" />
<Setter Property="Margin" Value="12,12,0,0"/>
<Setter Property="ItemTemplate">
<Setter.Value>
<DataTemplate>
<Border Background="{Binding Converter={StaticResource BackgroundConverter}}"
Width=""
Height=""
Margin="">
<TextBlock Text="{Binding Key}"
Foreground="{Binding Converter= {StaticResource ForegroundConverter}}"
Font Family="{StaticResource PhoneFontFamilySemiBold}"
FontSize=""
Padding=""
VerticalAlignment="Bottom"/>
</Border>
</DataTemplate>
</Setter.Value>
</Setter>
</Style>
</phone:PhoneApplicationPage.Resources>

这里有一点值得注意的是 JumpListItemBackgroundConverter and JumpListItemForegroundConverter
如果想设置可点击或不可点击的样式,可以用Disabled="Bisque" Enabled="Aqua"像下面这样

<phone:JumpListItemBackgroundConverter Disabled="Bisque" Enabled="Aqua" x:Key="BackgroundConverter"/><phone:JumpListItemForegroundConverter Disabled="Azure" Enabled="BlueViolet" x:Key="ForegroundConverter"/>

4.下面是官方给的一些属性,方法,和事件的变化。

从Windows Phone Toolkit 7.1的属性中

删除了

  • BufferSize
  • IsBouncy
  • IsScrolling
  • MaximumFlickVelocity
  • ShowListFooter/ShowListHeader

修改了

Windows Phone Toolkit 7.1

Windows Phone 8 ROM SDK

DisplayAllGroups

Display all groups in the list whether or not they have items. Default is true.

HideEmptyGroups

Hide all groups in the list without items. Default is false.
分组下没有项的话隐藏分组

GroupItemTemplate

JumpListStyle

IsFlatList

Gets or sets whether the list is flat instead of a group hierarchy. Default is true.

IsGroupingEnabled

Gets or sets whether the list is flat instead of a group hierarchy. Default is false. 分组展示需要开启此属性

新增部分

  • GridCellSize
  • LayoutMode LongListSelectorLayoutMode { List, Grid };
  • ManipulationState
public enum ManipulationState
{
Idle, // nothing is manipulating or animating
Manipulating, // Gesture is being recognized, finger is down and any delta is received, drag/pan or flick
Animating //No Gesture is currently happening, but there is some animation happening, like scroll animation or compression animation
}

从Windows Phone Toolkit 7.1的方法中

删除了

  • AnimateTo(object item)
  • CloseGroupView()
  • DisplayGroupView()
  • GetItemsInView()
  • GetItemsWithContainers(bool onlyItemsInView, bool getContainers)
  • ScrollToGroup(object group)

从Windows Phone Toolkit 7.1的事件中

删除了

  • StretchingBottom
  • StretchingCompleted
  • StretchingTop

修改了

Windows Phone Toolkit 7.1

Windows Phone 8 ROM SDK

ScrollingCompleted

ScrollingStarted

ManipulationStateChanged

(coupled with ManipulationState property)两者合二为一了

Link/Unlink

ItemRealized/ ItemUnrealized

With EventArgs including ItemKind

C#
  1. publicclassItemRealizationEventArgs : EventArgs
  2. {
  3. ///<summary>
  4. /// The ContentPresenter which is displaying the item.
  5. ///</summary>
  6. publicContentPresenter Container { get; }
  7. ///<summary>
  8. /// Gets the kind of item that is realized
  9. ///</summary>
  10. publicLongListSelectorItemKind ItemKind { get; }
  11. }
  12. ///<summary>
  13. /// Different kinds of items that exists in LongListSelector
  14. ///</summary>

可以看到,其实变化挺大的。

wp 8 sdk中的LLS性能 明显要比之前提高了不少。

当然 panorama,和pivot的性能也有了很大的提高,尤其是panorama的数据加载。

最后微软建议我们用longlistselector代替ListBox(这种说法几乎到处可见)

那么到底LLS比ListBox好在那里呢?请关注我的下篇文章。

LongListSelector 控件 在 wp7 和wp8中的不同之处的更多相关文章

  1. Wp8—LongListSelector控件使用

    其实从去年后半年起,自己就开始学习windows phone 8 的开发,主要是自己感兴趣同时我也很看好这个系统(现在还是感觉自己认识的有点晚了).工作日的话基本很忙,所以当时想到然的认为用晚上时间可 ...

  2. 如何使用免费PDF控件从PDF文档中提取文本和图片

             如何使用免费PDF控件从PDF文档中提取文本和图片 概要 现在手头的项目有一个需求是从PDF文档中提取文本和图片,我以前也使用过像iTextSharp, PDFBox 这些免费的PD ...

  3. 因为此控件已在 web.config 中注册并且与该页位于同一个目录中

    在web.config文件配置了用户控件 <pages> <controls> <add tagPrefix="my" tagName="l ...

  4. 《ASP.NET1200例》解决母版页报错“内容控件必须是内容页中的顶级控件,或是引用母版页的嵌套母版页。”

    VS2005下,添加了母版页这个控件,我们可以讲N个页面中共同的部分放在母版页来实现,并让WEB窗体集成自我们的母版页,就可以让我们的站点具有统一的风格了.在VS2005SP1之前的版本中,我们只能创 ...

  5. VS2010 Chart控件(一)Chart控件在ASP.NET网站中的应用示例详解(C#语言)

    步骤如下: 1. Chart控件(一)Chart控件在ASP.NET网站中的应用示例详解(C#语言)" title="VS2010 Chart控件(一)Chart控件在ASP.NE ...

  6. 玩转控件:重绘DEVEXPRESS中DateEdit控件 —— 让DateEdit支持只选择年月 (提供源码下载)

      前言 上一篇博文<玩转控件:重绘ComboBox —— 让ComboBox多列显示>中,根据大家的回馈,ComboBox已经支持筛选了,更新见博文最后最后最后面.   奇葩 这两天遇到 ...

  7. MFC中给控件添加变量,DoDataExchange中

    DoDataExchange函数其实是一项数据动态绑定技术.比如你在写动态按钮过程中须对按钮添加变量时,怎么添加?控件类已经写好了,其变量是已经固定的.你要添加新的变量就要用到DoDataExchan ...

  8. 列表控件ListBox关联的MFC中的类:CListBox

    列表控件ListBox关联的MFC中的类:CListBox ######################################################## 1.在列表的结尾添加一项: ...

  9. 高级列表控件ListCtrl关联的MFC中的类:CListCtrl

    高级列表控件ListCtrl关联的MFC中的类:CListCtrl■ 报表样式ListCtrl常用操作:1.添加列标题头:InsertColumn2.获取与设置列宽:GetColumnWidth.Se ...

随机推荐

  1. thinkPHP--模块分组

    启用分组模块非常简单,配置下APP_GROUP_LIST参数和DEFAULT_GROUP参数即可. 'APP_GROUP_LIST'=>'Admin,Home', 'DEFAULT_GROUP' ...

  2. Redis的下载安装

    Redis官网只提供了Linux版,MicroSoft自己搞了个Windows版,可在GitHub下载: https://github.com/microsoftarchive/redis/relea ...

  3. Java面试:投行的15个多线程和并发面试题(转)

    多线程和并发问题已成为各种 Java 面试中必不可少的一部分.如果你准备参加投行的 Java 开发岗位面试,比如巴克莱银行(Barclays).花旗银行(Citibank).摩根史坦利投资公司(Mor ...

  4. linux_base-f10-10_7 linuxulator is not (kld)loaded

    # cd linux_base-f10/# make install clean===>  linux_base-f10-10_7 linuxulator is not (kld)loaded. ...

  5. java代码(ascii与字母互转)

    package test; /** * Java中将一个字符与对应Ascii码互转 * 1 byte = 8bit 可以表示 0-127 */ public class GetCharAscii { ...

  6. CSS-学习笔记四

    1.*用于匹配任何的标记 2.>用于指定父子节点关系 3.E+F毗邻元素选择器,匹配所以紧随E元素之后的同级元素F 4.E~F匹配所以E元素之后的同级元素F 5.名称[表达式] [att=val ...

  7. codevs 1262 不要把球传我 2012年CCC加拿大高中生信息学奥赛

    时间限制: 1 s  空间限制: 128000 KB  题目等级 : 白银 Silver 题目描述 Description CCC的足球比赛和传统的足球比赛有一点不同, 一次进球当且仅当先后接触到球的 ...

  8. 图像处理框架 Core Image 介绍

    这篇文章会为初学者介绍一下 Core Image,一个 OS X 和 iOS 的图像处理框架. 如果你想跟着本文中的代码学习,你可以在 GitHub 上下载示例工程.示例工程是一个 iOS 应用程序, ...

  9. QT5:第八章 信号与槽机制

    一.简介 QT编程中信号与槽用于处理界面各个组件的交互,类似与MFC的消息循环和绑定 注意:在使用信号与槽的类中,必须在类的定义中加入宏定义Q_OBJECT 信号(Signal)就是在特定情况下被发射 ...

  10. javase(6)_异常

    一.异常的概念 1.java异常是Java提供的用于处理程序中错误的一种机制. 2.所谓错误是程序在运行过程中发生的一些异常事件(如:除0,数组下标越界,文件不存在等). 3.Java程序的执行过程中 ...