Click here to Skip to main content
15,893,594 members
Articles / Web Development

Paginating Records in Silverlight DataGrid using PagedCollectionView

Rate me:
Please Sign up or sign in to vote.
4.96/5 (15 votes)
2 Jan 2011CPOL5 min read 66.1K   1K   19  
Do you have a huge collection of data inside your DataGrid and want to integrate Pagination to show records page by page and don’t know how to do? Then this article will help you to understand the same.
using System.Collections.ObjectModel;
using DataGridDemo1.Models;

namespace DataGridDemo1.Providers
{
    public class EmployeeProviders
    {
        /// <summary>
        /// Gets the employee details.
        /// </summary>
        /// <returns></returns>
        public static ObservableCollection<Employee> GetEmployeeDetails()
        {
            return new ObservableCollection<Employee>
                       {
                           new Employee
                               {
                                   Firstname = "Kunal",
                                   Lastname = "Chowdhury",
                                   Age = 28,
                                   City = "Pune",
                                   State = "Maharashtra",
                                   Country = "India",
                                   Department = "Silverlight"
                               },
                           new Employee
                               {
                                   Firstname = "Abhijit",
                                   Lastname = "Jana",
                                   Age = 27,
                                   City = "Hyderabad",
                                   State = "Andhra Pradesh",
                                   Country = "India",
                                   Department = "ASP.Net"
                               },
                           new Employee
                               {
                                   Firstname = "Abhishek",
                                   Lastname = "Sur",
                                   Age = 28,
                                   City = "Kolkata",
                                   State = "West Bengal",
                                   Country = "India",
                                   Department = "CSharp"
                               },
                           new Employee
                               {
                                   Firstname = "Dhananjay",
                                   Lastname = "Kumar",
                                   Age = 29,
                                   City = "Pune",
                                   State = "Maharashtra",
                                   Country = "India",
                                   Department = "WCF"
                               },
                           new Employee
                               {
                                   Firstname = "Kapil",
                                   Lastname = "Sen",
                                   Age = 26,
                                   City = "Pune",
                                   State = "Maharashtra",
                                   Country = "India",
                                   Department = "Silverlight"
                               },
                           new Employee
                               {
                                   Firstname = "Mangal",
                                   Lastname = "Chawhan",
                                   Age = 25,
                                   City = "Chennai",
                                   State = "Tamilnadu",
                                   Country = "India",
                                   Department = "CSharp"
                               },
                           new Employee
                               {
                                   Firstname = "Soumen",
                                   Lastname = "Roy",
                                   Age = 27,
                                   City = "Kolkata",
                                   State = "West Bengal",
                                   Country = "India",
                                   Department = "CSharp"
                               },
                           new Employee
                               {
                                   Firstname = "Shakti",
                                   Lastname = "Singh",
                                   Age = 30,
                                   City = "Bangalore",
                                   State = "Karnataka",
                                   Country = "India",
                                   Department = "Silverlight"
                               },
                       };
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Technical Lead
India India

Kunal Chowdhury is a former Microsoft "Windows Platform Development" MVP (Most Valuable Professional, 2010 - 2018), a Codeproject Mentor, Speaker in various Microsoft events, Author, passionate Blogger and a Senior Technical Lead by profession.

He is currently working in an MNC located in India. He has a very good skill over XAML, C#, Silverlight, Windows Phone, WPF and Windows app development. He posts his findings, articles, tutorials in his technical blog (www.kunal-chowdhury.com) and CodeProject.


Books authored:


Connect with Kunal on:





Comments and Discussions