Summary of Pagedcollectionview in Sliverlight

Source: Internet
Author: User

In SL, a default view is implicitly inserted between the source and the target, as long as it is bound to a collection that implements the IEnumerable interface, which stores information about the current item and supports

Sorting, grouping, filtering, navigating these features, here is a summary of Pagedcollectionview this view of the use of a few.

In fact, the view is automatically associated to the source collection rather than to the target object of the source, so changes to the views are automatically displayed on the target object.

Here are a few features to sum up:

Sort:

Mainly using the Sortdescriptions property to control View items, the basic idea is to select a property in the collection as a reference, and then set the way to sort, this setting will eventually be captured by a Sortdescription object.

Use an example to illustrate this problem:

First, create a data type, taking the photo class as an example:

public class Photo { public string Name { get; set; } public DateTime date { get; set; } public  int Id { get; set; } }

Gets one of its data sets:

public class Photo
         {
         public string Name { get; set; }
         public DateTime date { get; set; }
         public int Id { get; set; }
         }

Gets one of its data sets:

public class Photos
         {
         public  List<Photo> GetList()
         {
             var list = new List<Photo>
             {
                  new Photo{Name="Simens",Id=1,date=Convert.ToDateTime("2010/8/10")},
                  new Photo{Name="Sunshine",Id=2,date=Convert.ToDateTime("2010/8/13")},
                  new Photo{Name="TreeInforest",Id=3,date=Convert.ToDateTime("2010/8/15")},
                  new Photo{Name="WaterNaturl",Id=4,date=Convert.ToDateTime("2010/8/12")},
             };
             return list;
         }

Here we take the DataGrid as an example, and for the whole process to be clearer, we set its Canusersortcolumns property to false and sort the data in the DataGrid by clicking the button

Ui:

<data:DataGrid AutoGenerateColumns="True" Height="131" HorizontalAlignment="Left" Margin="43,75,0,0"  Name="dataGrid1" 
         CanUserSortColumns="False" VerticalAlignment="Top" Width="289" />
         <Button Content="SortByName" Height="23" HorizontalAlignment="Left" Margin="52,221,0,0" Name="SortByName"  VerticalAlignment="Top"
          Width="75" Click="SortByName_Click" />
         <Button Content="SortByDateTime" Height="23" HorizontalAlignment="Left" Margin="141,221,0,0"  Name="SortByDateTime"
         VerticalAlignment="Top" Width="75" Click="SortByDateTime_Click" />

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.