2012-01-12 66 views
0

我想使用LongListSelector按字母順序對條目列表進行分組。 實際上可以即時unsing正常ListBox,它看起來像:使用LongListSelector按字母順序對列表進行分組的簡單方法?

  • Andhed
  • Bdihed
  • Cndie

我要像獅集團所有項目:

  • Andhed
  • Bdihed
  • Ç
  • Cndie

我知道我可以用LongListSelector問題是這樣做,我不想改變我的數據,它的一個簡單List<String>這是可能的?我不想添加像包含項目(例如Andhed)的羣組(例如A)的附加結構。

回答

0

對於LongListSelector,您必須先將數據分組,然後再將其與控件相關聯。這並不是很糟糕,特別是如果你使用模型(如Model-View-ViewModel)。

作爲替代方案,我已經寫了這是在這裏提出了一個跳轉列表控制:

http://www.scottlogic.co.uk/blog/colin/2011/01/a-windows-phone-7-jump-list-control/

與此對照,你使用CategoryProvider,這將組列表中的數據:

<!-- category provider - details how the items are grouped --> 
    <l:JumpList.CategoryProvider> 
    <l:AlphabetCategoryProvider PropertyName="Surname"/> 
    </l:JumpList.CategoryProvider> 
相關問題