众所周知,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. Bingding模型

    public abstract class Binding : IDefaultCommunicationTimeouts public virtual IChannelListener<TCh ...

  2. VUE注意事项(建项目)

    1>删除空格影响的:删除掉框中的代码 2>不需要新建,直接打开APP.vue,在此文件上进行修改,(注意:index.html最好不要进行修改) 3>修改APP.vue为自己需要的页 ...

  3. hihocoder1636 Pangu and Stones

    思路: 区间dp.dp[l][r][k]表示把区间[l, r]的石子合并成k堆所需要的最小代价. 实现: #include <iostream> #include <cstring& ...

  4. CF1066B Heaters

    思路: 从左向右贪心选择能覆盖当前位置的最靠右的那个heater即可,和poj radar installation类似. 实现: #include <iostream> #include ...

  5. KMP字符串模式匹配详解

    KMP字符串模式匹配详解 http://www.cppblog.com/oosky/archive/2006/07/06/9486.html

  6. Android笔记--Bitmap(三) 针对不用Android版本的位图管理

    Bitmap(三) | Android不同版本的相应操作 在不同的Android版本中.位图的存储方式是不同的. 1.小于等于 Android 2.2 (API level 8) 垃圾收集器回收内存时 ...

  7. Caused by: javax.el.PropertyNotFoundException: Property 'title' not found on type java.lang.String

    问题:在JSP页面显示从后台传过来的list集合数据报错. 错误信息: Caused by: javax.el.PropertyNotFoundException: Property 'title' ...

  8. JavaScript数据格式验证探讨

    1.需求 修改某个文本框数据,要求对修改后的格式做验证(必须是数字). 注:实际需求比上述复杂,为了说明问题,这里特意简化了需求(如:对修改后数据依赖条件的判断,数据入库等). 2.关于NaN的探讨( ...

  9. C#语言基础 Main 函数中变量 整型

    在我们每次上网或者用电脑的时候,请输入你的xxx 或者你的名字(年龄/身高/学校/籍贯)是 在这里我们就要学到一些变量,就是不确定的东西 string a:   //赋予变量 a ="内容& ...

  10. 记录我开发工作中遇到HTTP跨域和OPTION请求的一个坑

    我通过这篇文章把今天工作中遇到的HTTP跨域和OPTION请求的一个坑记录下来. 场景是我需要在部署在域名a的Web应用里用JavaScript去消费一个部署在域名b的服务器上的服务.域名b上的服务也 ...