当前位置 > 首页 > Asp.net

Silverlight 3 DataGrid Columns Grouping

2009-8-1 21:30:00来源:Asp.net

In this post I am showing how to implement Column Grouping in SIlverlight 3 DataGrid,

Before starting make sure you have SIlverlight3_Tools installed in your system, not SIlverlight 3 Beta, as there are lost of changes in Grouping of Columns from SIlverlight 3 Beta to Silverlight 3 RTW.

 image

You can follow the few simple steps below to get the Grouping for your Silverlight 3 DataGrid.

Else you can also download the code demonstrated from here.

1. Create an Silverlight Application using you Visual Studio 2008 IDE, and add a hosting web application in the project.

2. Once you have done with this, you will get an two projects in your Solution, you need to code only in your silverlight project.

3. Now add a C# class file called Person.cs in your Silverlight Project. This class is used to provide some sample data to Silverlight DataGrid, you can change this to your other datasources like SQL, XML, etc.

I have added the following lines of code in Person.cs

   1: public class Person
   2:     {
   3:         public string FirstName { get; set; }
   4:         public string LastName { get; set; }
   5:         public string City { get; set; }
   6:         public string Country { get; set; }
   7:         public int Age