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

Multiple Header Column

1 Answer 112 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Ramasamy
Top achievements
Rank 1
Ramasamy asked on 27 Sep 2011, 09:42 AM
Hi,

I am using the CommonHeaders stuff for the multiple column headers. 

 

<i:Interaction.Behaviors>
<local:ColumnGroupsBehavior>
<local:ColumnGroupsBehavior.CommonHeaders>
<local1:CommonHeader StartColumnIndex="0" Caption="" ColumnSpan="3" />
<
/local:ColumnGroupsBehavior.CommonHeaders>
</local:ColumnGroupsBehavior>
</i:Interaction.Behaviors>

My common headers are dynamic and need set in code behind. How it can be achieved at runtime.

Thanks,
Ramasamy

1 Answer, 1 is accepted

Sort by
0
Ramasamy
Top achievements
Rank 1
answered on 28 Sep 2011, 02:55 AM
Hi All,

I have solved this issue by adding the below stuff into the DataLoading event.

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);

and you can remove interaction.Behaviors block from xaml file.

Thanks,
Ramasamy
Tags
GridView
Asked by
Ramasamy
Top achievements
Rank 1
Answers by
Ramasamy
Top achievements
Rank 1
Share this question
or