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

[Solved] Complex Grid Header Layout

2 Answers 148 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Vassili King
Top achievements
Rank 1
Vassili King asked on 08 Dec 2010, 07:47 PM
Hello,

I'm trying to find a way to do something different with the GridView's header.  Below is a sample structure. Note that my first column is a complex one with a few items bound to several controls in its DataTemplate.

--------------------------------------------------------------------------------------------------------
|   Column 1 Header   |  Col.2 Hdr.  |  Multi-column hdr. (shared for 4 & 5)  |  Col. 5 Hdr.  |
|                              |                   |   specific to Col.  3  | specific to Col.4  |                    |
--------------------------------------------------------------------------------------------------------
|  [Photo]  Name       |                   |                              |                           |                   |
|               Address   |  data...         |  data.....                 |  data...                | data...          |
--------------------------------------------------------------------------------------------------------
|  [Photo]  Name       |                   |                              |                           |                   |
|               Address   |  data...         |  data.....                 |  data...                | data...          |
--------------------------------------------------------------------------------------------------------
|  [Photo]  Name       |                   |                              |                           |                   |
|               Address   |  data...         |  data.....                 |  data...                | data...          |
--------------------------------------------------------------------------------------------------------
|  [Photo]  Name       |                   |                              |                           |                   |
|               Address   |  data...         |  data.....                 |  data...                | data...          |
--------------------------------------------------------------------------------------------------------

Is there a way to do this with a header template? Or by adding 2 rows styled as a header to the grid after the grid has been bound? Or any other way?

Thank you!
-VK.

2 Answers, 1 is accepted

Sort by
0
Accepted
Vanya Pavlova
Telerik team
answered on 09 Dec 2010, 09:43 AM
Hello Vassili,

There is no problem to define custom Header in a GridViewDataColumn in the following matter:

<telerik:GridViewDataColumn DataMemberBinding="{Binding SomeProperty}" ......>
   <telerik:GridViewDataColumn.Header>
       <StackPanel>
           <TextBlock Text="Some Text" ..../>
           <TextBox x:Name="textBox1" ...../>
       </StackPanel>
   </telerik:GridViewDataColumn.Header>
</telerik:GridViewDataColumn>

However if you want to simulate merged-cells behavior I would suggest you to use the approach demonstrated in the following blog post "Adding additional power to RadGridView for Silverlight with attached behaviors".


Greetings,
Vanya Pavlova
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
0
Vassili King
Top achievements
Rank 1
answered on 09 Dec 2010, 08:30 PM

Vanya,

I knew how to customize header for one column already. I was looking for something very much like the  "Adding additional power to RadGridView for Silverlight with attached behaviors" article you've mentioned. A bit hacky, but it sure did work great!
 
Thank you for your help!

Tags
GridView
Asked by
Vassili King
Top achievements
Rank 1
Answers by
Vanya Pavlova
Telerik team
Vassili King
Top achievements
Rank 1
Share this question
or