This is a migrated thread and some comments may be shown as answers.

Multiple Heading Rows

3 Answers 54 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Eduan Marais
Top achievements
Rank 2
Eduan Marais asked on 18 May 2010, 09:29 PM
Hi.

I would like to have more than 1 row as a heading to my grid.
I would like to have a heading that is applicable to a couple of columns, with each underlying column still having its own heading.

It should be simular to the formatting that you can do in excel, when you merge a couple of columns into 1 column, and still have columns underneath it, example
------------------------------------
|            Data Group             |
------------------------------------
|Column1|Column2|Column3|
------------------------------------

I have a project where I need to add columns to my radgrid in code, so please help with a WPF C# example.

Thanks.

3 Answers, 1 is accepted

Sort by
0
Yavor Georgiev
Telerik team
answered on 19 May 2010, 12:10 PM
Hi Eduan Marais,

 Please check out this blog post: http://blogs.telerik.com/pavelpavlov/posts/09-12-04/adding_additional_power_to_radgridview_for_silverlight_with_attached_behaviors.aspx

Kind regards,
Yavor Georgiev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Eduan Marais
Top achievements
Rank 2
answered on 19 May 2010, 01:35 PM
HI.

Thank you, I will look into it.
I was hoping to something where everyting is done in code. In my situation, I do not know how many columns or column groupings will be needed, so I can not hard code it in xaml. I am generating logsheets for plant environments, to each plant is different. The details on how many columns and column groups is passed to me during runtime, so I need to build these headings dynamically, based on the information given to me.

Regards

Eduan
0
Yavor Georgiev
Telerik team
answered on 19 May 2010, 02:57 PM
Hello Eduan Marais,

 You can create this behavior in code like so:

var behaviour = new ColumnGroupsBehavior
{
    CommonHeaders = new ObservableCollection<CommonHeader>
    {
        new CommonHeader { StartColumnIndex = 0, Caption = "Vehicle info", ColumnSpan = 2 },
        new CommonHeader { StartColumnIndex = 2, Caption = "Dimensions (mm)", ColumnSpan = 3 },
        new CommonHeader { StartColumnIndex = 5, Caption = "Total Price", ColumnSpan = 1 }
    }
};
behaviour.Attach(this.RadGridView1);

You can modify the ColumnHeaders collection as you like.

Best wishes,
Yavor Georgiev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
GridView
Asked by
Eduan Marais
Top achievements
Rank 2
Answers by
Yavor Georgiev
Telerik team
Eduan Marais
Top achievements
Rank 2
Share this question
or