简体   繁体   中英

List sorting in windows phone 8.1

In windows phone 8.1 list, I want to add sorting. User can change the order of a column data into ascending and descending.

Is it possible in windows phone 8.1 application? if yes, please paste some sample code here.

Check out <CollectionViewSource> : MSDN CollectionViewSource . It basically has almost everything you're looking for. They have a nice example at the bottom of the page.

With the right LINQ statements and orderby you can sort your list the way you want, then you can assign this sorted list as the ItemsSource of a ListView or whatever UI container of your choosing.

There is no SortedList for Windows Phone 8.1 but Google has provided a nice replacement:

https://code.google.com/p/protobuf-csharp-port/source/browse/src/ProtocolBuffers/SortedList.cs?r=ae984f8d40f95a3d213b57c34d2eaf94d4abc0f8

You can also try SortedDictionary.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM