Almost every application to work with the data we have to work with the tables for display to the user of any data which it has applied. For users familiar applications such pages and comfortable enough, but not always easy to implement a particular display logic for complex data structures such as the customer wants them to be. We give a simple example, let us have the lists A and B, are related by 1: n, each element of the list B contains three attributes - the key, the record type and value, types of records that can be repeated. Suppose we want to display the record of A, so that each row of A list displays all values ​​from the list B, the record type is used as a title

Students (List A)

Id

Name

1

John

2

Alex

3

Sara

Marks (List B)

Id

Student

Category

Value

1

1

C#

5

2

1

Java

4

3

1

HTML & CSS

4

4

2

C#

4

5

3

Java

3

We need to get the following table:

Id

Name

Marks

C#

Java

HTML & CSS

1

John

5

4

4

2

Alex

4

-

-

3

Sara

-

3

-

Application in which I faced with such a task was developed using the technology of Silverlight. Built-in DataGrid functionality described above is not realized.
This led to the development of special control FluentGrid.

How it works:

FluentDataGrid - is the control that builds
a table based on a custom data source FluentGridSource. Currently, the construction of the table (view) is available only at runtime. FluentGridSource
has Fluent-like interface for the formation of rules of construction.

The key source of data is the formation of the class, which will be a "model line."
She describes one row of the result table, for our example of such a class might look like

The base class implements the INotifyPropertyChangedPropertyChangedBase. We see that in the line two "static" column Id and Name, attribute DynamicHeader helps us set a cap column. There is also a list of Marks, a "dynamic" of the table, which can be constructed, for example, by using LINQ. Its elements have to implement a special interface IDynamicElement.

In forming a data source, you can add formatting rules AddFromatter (), totals AddSummary (), validation rules for totals AddValidator (), the validation rules of values ​​in table cells AddCellValidator (), and set rules for the formation of the hierarchy. In order to specify the hierarchy, you must specify the property model - key (Id), the property - a reference to the parent element (ParentId) and the property on which to display the hierarchy.

Comments and Discussions

Hi, I added your solution in my silverlight project but grid formation is not working in silverlight. do you have any idea regarding this? I like your this post. but some problem is in this so i need some help.thanks.