众所周知,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. java emoji表情存储解决方案

    1.问题产生情况 我遇到这个问题是做微信开发的时候有些有用的头像用了微信的emoji表情,然而我的mysql数据库用的编码是utf8_general_ci,就是utf-8编码,结果也就报错误了. 2. ...

  2. vue 引用其他组件

    1.在components 目录下新建Test.vue 文件 <template> <div class="test"> <h1>{{ msg ...

  3. pingall脚本

    p i n g a l l:一个按照/ e t c / h o s t s文件中的条目逐一p i n g所有主机的脚本 它能够按照/ e t c / h o s t s文件中的条目逐一p i n g所 ...

  4. Idea 2017注册码

    BIG3CLIK6F-eyJsaWNlbnNlSWQiOiJCSUczQ0xJSzZGIiwibGljZW5zZWVOYW1lIjoibGFuIHl1IiwiYXNzaWduZWVOYW1lIjoiI ...

  5. MyBatis插入数据之后返回插入记录的id

    MyBatis插入数据的时候,返回该记录的id<insert id="insert" keyProperty="id" useGeneratedKeys= ...

  6. C# 一维数组 冒泡排序

    假设有个三个杯子    一个杯子中有一个紫色的乒乓球  一个没有  一个有红色乒乓球    杯子不能动 怎么把紫色和红色的调换呢 主要是先把紫色的放到空的杯子   在把红的放到紫色原来的杯子   再把 ...

  7. 异步 BeginInvoke

    委托的异步调用异步多线程的三大特点:1.同步方法卡界面,原因是主线程被占用:异步方法不卡界面,原因是计算交给了别的线程,主线程空闲2.同步方法慢,原因是只有一个线程计算:异步方法快,原因是多个线程同事 ...

  8. 5 Options for Distributing Your iOS App to a Limited Audience

    http://mobiledan.net/2012/03/02/5-options-for-distributing-ios-apps-to-a-limited-audience-legally/ I ...

  9. SniperOj-shorter-shellcode-x86

    shell-storm 这里可以有一些可以用的shellcode,不过自己写才是biner的骄傲 /奋斗 0x00 不会写shellcode(和一条咸鱼有什么区别/哭) 0x01 这题目前有俩种解法 ...

  10. Struts2 执行流程

    struts2执行原理(执行流程) 一个请求在Struts2框架中的处理大概分为以下几个步骤: 1 客户端发送请求:(HttpServletRequest)2 这个请求经过一系列的过滤器(Filter ...