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
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.
Thanks for the solution. How can I use checkboxes in header? In one header from many.
Regards,
Ladislav
the header content ist clipped. How should I set header Height to Stretch?
Regards,
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.
telerik:GridViewHeaderCell
Error 24 Type 'telerik:GridViewHeaderCell' was not found.
Am I missing something?
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.
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
ContentPresenter.LayoutTransform not found in silverlight 4
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
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
GridViewHeaderCell is in the Telerik.Windows.Controls.GridView namespace.
Greetings,
Pavel Pavlov
the Telerik team
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?
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
You could not help me.
Whatever.
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
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 ... )
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