Rotating GridView Column Header

18 posts, 1 answers
  1. Ladislav
    Ladislav avatar
    32 posts
    Member since:
    Jan 2009

    Posted 02 Feb 2009 Link to this post

    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
  2. Answer
    Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 02 Feb 2009 Link to this post

    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.
  3. UI for WPF is Visual Studio 2017 Ready
  4. Ladislav
    Ladislav avatar
    32 posts
    Member since:
    Jan 2009

    Posted 02 Feb 2009 Link to this post

    Hi Vlad,

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

    Regards,
    Ladislav
  5. Ladislav
    Ladislav avatar
    32 posts
    Member since:
    Jan 2009

    Posted 02 Feb 2009 Link to this post

    Hi Vlad,

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

    Regards,
    Ladislav
  6. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 05 Feb 2009 Link to this post

    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.
  7. N_avtar
    N_avtar avatar
    13 posts
    Member since:
    Sep 2009

    Posted 28 Dec 2009 Link to this post

    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?
  8. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 29 Dec 2009 Link to this post

    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.
  9. N_avtar
    N_avtar avatar
    13 posts
    Member since:
    Sep 2009

    Posted 30 Dec 2009 Link to this post

    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
  10. MK
    MK avatar
    29 posts
    Member since:
    Jul 2010

    Posted 17 Aug 2010 Link to this post

    show error
    ContentPresenter.LayoutTransform not found in silverlight 4
  11. Pavel Pavlov
    Admin
    Pavel Pavlov avatar
    2039 posts

    Posted 17 Aug 2010 Link to this post

    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
  12. Kiran Ghanwat
    Kiran Ghanwat avatar
    38 posts
    Member since:
    Nov 2009

    Posted 01 Oct 2010 Link to this post

    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

  13. Pavel Pavlov
    Admin
    Pavel Pavlov avatar
    2039 posts

    Posted 01 Oct 2010 Link to this post

    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
  14. Zlatko
    Zlatko avatar
    5 posts
    Member since:
    Sep 2013

    Posted 03 Sep 2015 in reply to Pavel Pavlov Link to this post

    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?

  15. Pavel
    Pavel avatar
    1 posts
    Member since:
    Oct 2012

    Posted 03 Sep 2015 in reply to Zlatko Link to this post

    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

     

  16. Zlatko
    Zlatko avatar
    5 posts
    Member since:
    Sep 2013

    Posted 04 Sep 2015 in reply to Pavel Link to this post

    You could not help me.
    Whatever.

  17. Yoan
    Admin
    Yoan avatar
    1066 posts

    Posted 08 Sep 2015 Link to this post

    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
  18. Tino
    Tino avatar
    3 posts
    Member since:
    Feb 2015

    Posted 11 Feb in reply to Yoan Link to this post

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

  19. Petya
    Admin
    Petya avatar
    975 posts

    Posted 16 Feb Link to this post

    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
Back to Top
UI for WPF is Visual Studio 2017 Ready