Click here to Skip to main content
15,884,298 members
Articles / Web Development

Customizing Group Row Header of Silverlight DataGrid

Rate me:
Please Sign up or sign in to vote.
4.89/5 (17 votes)
20 Jan 2011CPOL6 min read 101.7K   1.2K   23  
This article will definitely help you. Here, I will show you how to modify the XAML to add different content to create a multi level row group header too.
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