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

Rotating GridView Column Header

17 Answers 579 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Ladislav
Top achievements
Rank 1
Ladislav asked on 02 Feb 2009, 07:50 AM
Hi,
I would like to set the header Template to

                        <DataTemplate>
                            <TextBlock Text="{Binding}" >
                                    <TextBlock.LayoutTransform>
                                        <RotateTransform Angle="-45" />
                                    </TextBlock.LayoutTransform>
                            </TextBlock>
                        </DataTemplate>

I haven't found any solution.

Regards,
Ladislav

17 Answers, 1 is accepted

Sort by
0
Accepted
Vlad
Telerik team
answered on 02 Feb 2009, 08:05 AM
Hi Ladislav,

Here is an example:
<telerik:RadGridView Name="RadGridView1"
                <telerik:RadGridView.Resources> 
                    <Style TargetType="telerik:GridViewHeaderCell"
                        <Setter Property="Template"
                            <Setter.Value> 
                                <ControlTemplate TargetType="telerik:GridViewHeaderCell"
                                    <ContentPresenter> 
                                        <ContentPresenter.LayoutTransform> 
                                            <RotateTransform Angle="-45" /> 
                                        </ContentPresenter.LayoutTransform> 
                                    </ContentPresenter> 
                                </ControlTemplate> 
                            </Setter.Value> 
                        </Setter> 
                    </Style> 
                </telerik:RadGridView.Resources> 
            </telerik:RadGridView> 


Regards,
Vlad
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Ladislav
Top achievements
Rank 1
answered on 02 Feb 2009, 08:18 AM
Hi Vlad,

Thanks for the solution. How can I use checkboxes in header? In one header from many.

Regards,
Ladislav
0
Ladislav
Top achievements
Rank 1
answered on 02 Feb 2009, 08:47 AM
Hi Vlad,

the header content ist clipped. How should I set header Height to Stretch?

Regards,
Ladislav
0
Vlad
Telerik team
answered on 05 Feb 2009, 01:17 PM
Hi Ladislav,

You can define the check box in the template. Here is also a bit modified version of the xaml to increase header height:
       <telerik:RadGridView Name="RadGridView1"
            <telerik:RadGridView.Resources> 
                <Style TargetType="telerik:GridViewHeaderCell"
                    <Setter Property="Template"
                        <Setter.Value> 
                            <ControlTemplate TargetType="telerik:GridViewHeaderCell"
                                <StackPanel> 
                                    <CheckBox/> 
                                    <ContentPresenter> 
                                        <ContentPresenter.LayoutTransform> 
                                            <RotateTransform Angle="-45" /> 
                                        </ContentPresenter.LayoutTransform> 
                                    </ContentPresenter> 
                                </StackPanel> 
                            </ControlTemplate> 
                        </Setter.Value> 
                    </Setter> 
                </Style> 
                <DataTemplate x:Key="GridViewHeaderIndentCellDataTemplate"
                    <telerik:GridViewHeaderIndentCell /> 
                </DataTemplate> 
 
                <ControlTemplate x:Key="GridViewHeaderRowTemplate" TargetType="telerik:GridViewHeaderRow"
                    <Grid> 
                        <Grid.ColumnDefinitions> 
                            <ColumnDefinition Width="Auto" /> 
                            <ColumnDefinition Width="Auto" /> 
                            <ColumnDefinition /> 
                        </Grid.ColumnDefinitions> 
                        <telerik:IndicatorPresenter x:Name="PART_IndicatorPresenter" Visibility="{TemplateBinding RowIndicatorVisibility}" VerticalAlignment="Stretch" Grid.Column="0" /> 
                        <telerik:IndentPresenter x:Name="PART_IndentPresenter" ItemTemplate="{StaticResource GridViewHeaderIndentCellDataTemplate}"  IndentLevel="{TemplateBinding IndentLevel}" Grid.Column="1" /> 
                        <telerik:DataCellsPresenter x:Name="PART_DataCellsPresenter" Grid.Column="2" /> 
                    </Grid> 
                </ControlTemplate> 
 
                <Style TargetType="telerik:GridViewHeaderRow"
                    <Setter Property="Template" Value="{StaticResource GridViewHeaderRowTemplate}" /> 
                </Style> 
 
            </telerik:RadGridView.Resources> 
        </telerik:RadGridView> 


All the best,
Vlad
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
N_avtar
Top achievements
Rank 1
answered on 28 Dec 2009, 09:52 PM
Whenever i am trying your code in my xaml file it is showing this error
 telerik:GridViewHeaderCell


Error    24    Type 'telerik:GridViewHeaderCell' was not found.  
Am I missing something?
0
Vlad
Telerik team
answered on 29 Dec 2009, 06:50 AM
Hi N_avtar,

Can you show us how "telerik" namespace is registered in your case?

Kind regards,
Vlad
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
N_avtar
Top achievements
Rank 1
answered on 30 Dec 2009, 04:26 PM
issue solved.
I drag and drop the telerik grid view.It comes up with some namespace.
I changed the name space and it is working good.
Thanks,
N avatar
0
MK
Top achievements
Rank 1
answered on 17 Aug 2010, 02:32 PM
show error
ContentPresenter.LayoutTransform not found in silverlight 4
0
Pavel Pavlov
Telerik team
answered on 17 Aug 2010, 04:26 PM
Hello Mahesh,

I believe the reason for the trouble is that you are trying to run a WPF specific code in Silverlight.
This thread is under the WPF section , however I am pasting some XAML for you to try under Silverlight.
<telerik:GridViewDataColumn  DataMemberBinding="{Binding MyProperty}" Width="40">
                    <telerik:GridViewDataColumn.Header>
                        <Border Height="100" Width="100" >
                            <TextBlock  Text="Store" HorizontalAlignment="Left" TextWrapping="Wrap"  FontWeight="Bold" Height="auto" TextAlignment="Center"  VerticalAlignment="Bottom" >
                            <TextBlock.RenderTransform>
                                <RotateTransform Angle="270" />
                            </TextBlock.RenderTransform>
                            </TextBlock>
                        </Border>
                    </telerik:GridViewDataColumn.Header>
                </telerik:GridViewDataColumn>


In case you have any further problems while implementing this , please post a new thread  in the Silverlight section to avoid further misunderstandings caused by mixing platforms.

Best wishes,
Pavel Pavlov
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
Kiran Ghanwat
Top achievements
Rank 1
answered on 01 Oct 2010, 02:29 PM
Hello Vlad,

    I am also changing GridViewHeaderStyle bt, I m getting 
    "The type reference cannot find a public type named 'GridViewHeaderCell'"
    error.

    My telerik namespace  is:

    xmlns

 

 

:telerikGrid="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView"

 


Please Help.

Thanks.
Kiran Ghanwat

0
Pavel Pavlov
Telerik team
answered on 01 Oct 2010, 03:08 PM
Hi Kiran Ghanwat,

GridViewHeaderCell  is  in the Telerik.Windows.Controls.GridView namespace.


Greetings,
Pavel Pavlov
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
Zlatko
Top achievements
Rank 1
answered on 03 Sep 2015, 12:40 PM

Hi Pavel

When we using 

<telerik:GridViewDataColumn.Header>

    <TextBlock Text="First name"/>

</telerik:GridViewDataColumn.Header>

instead of

<telerik:GridViewDataColumn Header="First name"/>

we are losing the colors from Theme when column is Sorted or column ceader is selected.

What is your purpose to solve this problem?

0
Pavel
Top achievements
Rank 1
answered on 03 Sep 2015, 12:53 PM

Hi Zlatko , 

This is an expected behavior. 

When re-templating the header - as in your case -  you take the responsibility of the visual appearance of the header in your hands. Once the template of the header is changed RadGridView can not know what is inside thus any default logic including the theming mechanism will not work.

I may suggest to copy the default style of the column header as mentioned in this article   http://docs.telerik.com/devtools/wpf/controls/radgridview/styles-and-templates/styling-column-headers

 Then you can apply your specific changes to this style . 

 

Hope that helps, 

Regards, 

Pavel Pavlov

 

0
Zlatko
Top achievements
Rank 1
answered on 04 Sep 2015, 07:43 AM

You could not help me.
Whatever.

0
Yoan
Telerik team
answered on 08 Sep 2015, 07:56 AM
Hello Zlatko,

Indeed, when you changed the content of GridViewHeaderCell you need to modify its style/template if you want to have the default styles applied. I am sending you a sample project which demonstrates the approach. Please note that I am using our Implicit Styles as demonstrated in this help article. The default style is modified in Themes/Telerik.Windows.Controls.GridView.xaml file. You can find the custom template in Window's Resources.

I hope this helps.

Regards,
Yoan
Telerik
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 Feedback Portal and vote to affect the priority of the items
0
Tino
Top achievements
Rank 1
answered on 11 Feb 2016, 09:50 PM

Hi,

 it's ridiculous that a product that is for many years on the market has no basic functionality like header text wrap.

Suggested solutions for export to excel and themes are big improvisation and a big waste of time. And time is the reason for buying controls.

 As subscribed users I am very disappointed with the lack of some basic features in all Telerik products ( Wpf, Kendo, Reporting ... )

0
Petya
Telerik team
answered on 16 Feb 2016, 03:42 PM
Hi Tino,

I'm sorry to hear you feel that way.

One of the major factors that impact our roadmap is the customer feedback we receive and I wanted to take this opportunity to thank you for sharing yours.

As a licensed user, you have a couple of ways in which you can directly influence our plans:
1. By voting and commenting in the public portals (WPF, Reporting, Kendo UI). The more votes a suggestion collects, the higher priority it has.
2. By participating in surveys.

All three products that you've mentioned are actively worked on and we're adding new functionalities with each release. For a reference, you could have a look at the respective roadmaps for Q2 2016:
Kendo UI Roadmap
Reporting Roadmap
UI for WPF Roadmap

I understand that the scheduled features might not be the ones you need in the applications you're working on which might get frustrating. This is why our support team will try to propose a solution that will allow you to achieve the desired result with the available feature set when this is possible. I'd encourage you to continue using our support service and assure you we're doing our best to assist you.

As an alternative, if the lack of specific functionality is blocking your work and you don't have the time to work on it yourself, our professional services team can help speed up your development for an additional fee. If that is the case with header text wrapping in our WPF RadGridView and you're interested in such service, you can use the Contact us form on the page I sent you or just let me know and I'll make sure someone from the team contacts you.

I hope this information is useful. Let me know if I can be of further assistance.

Regards,
Petya
Telerik
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 Feedback Portal and vote to affect the priority of the items
Tags
GridView
Asked by
Ladislav
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Ladislav
Top achievements
Rank 1
N_avtar
Top achievements
Rank 1
MK
Top achievements
Rank 1
Pavel Pavlov
Telerik team
Kiran Ghanwat
Top achievements
Rank 1
Zlatko
Top achievements
Rank 1
Pavel
Top achievements
Rank 1
Yoan
Telerik team
Tino
Top achievements
Rank 1
Petya
Telerik team
Share this question
or