Hello.
Help me with next problem, how i can rotate column header text of GridViewDataColumn on 90 degree?
I am create columns in programm code
column = new GridViewDataColumn
{
ColumnGroupName = args.ColumnDef.ColumnGroupName,
DataMemberBinding = new Binding(args.ColumnDef.Member)
{
Mode = BindingMode.TwoWay,
UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged
},
IsReadOnlyBinding = new Binding(args.ColumnDef.IsReadOnlyMember)
{
Converter = new NullToBooleanConverter {IsInverted = true}
},
Header = args.ColumnDef.Header,
HeaderTextWrapping = TextWrapping.Wrap,
IsVisible = true,
};
Also, how i can add borders to cells?
5 Answers, 1 is accepted
I find that i can do this in 'Setting a Column's HeaderCellStyle' (https://docs.telerik.com/devtools/wpf/controls/radgridview/styles-and-templates/styling-column-headers), but i got suddenly result, all header cell content rotate on setted angle:
<Style BasedOn="{StaticResource GridViewHeaderCellStyle}" TargetType="telerik:GridViewHeaderCell">
<Setter Property="ToolTipService.ToolTip" Value="{Binding RelativeSource={x:Static RelativeSource.Self}, Path=Content.Text, Mode=OneWay}" />
<Setter Property="telerik:RadContextMenu.ContextMenu" Value="{StaticResource ColumnHeaderContextMenu}" />
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="Foreground" Value="Red"/>
<Setter Property="LayoutTransform">
<Setter.Value>
<RotateTransform Angle="90"/>
</Setter.Value>
</Setter>
</Style>
What i can do?
also, i am create
<Style BasedOn="{StaticResource GridViewGroupHeaderCell}" TargetType="telerik:GridViewGroupHeaderCell">
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="Foreground" Value="Red"/>
<Setter Property="Background" Value="Aqua"/>
<Setter Property="FontSize" Value="20"></Setter>
</Style>
but this don't work...why?
also, i am create
<Style BasedOn="{StaticResource GridViewGroupHeaderCell}" TargetType="telerik:GridViewGroupHeaderCell">
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="Foreground" Value="Red"/>
<Setter Property="Background" Value="Aqua"/>
<Setter Property="FontSize" Value="20"></Setter>
</Style>
but this don't work...why?
[/quote]
understand, need
<Style TargetType="telerik:CommonColumnHeader">
Hi Anton,
Thank you for the provided code snippets.
To rotate the columns' header, you need to extract and edit the default template of the GridViewHeaderCell. In the extracted template, you can rotate the Grid named PART_HeaderCellGrid to the specified angle. To fix the filter drop-down position, you will need to rotate the filter icon (grid:FilteringDropDown x:Name="PART_DistinctFilterControl") to open its dropdown content vertically. There is Editing Control Templates help article in our documentation, which describes how you can get the default template of the controls. I have prepared an example for you that demonstrates this approach.
The attached project uses XAML binaries, and the extracted template is based on the default one (Office_Black).
As for your second scenario, I am assuming that you have found a solution. Correct me if I am wrong.
Regards,
Dinko
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products, quickly just got a fresh new look + new and improved content, including a brand new Blazor course! Check it out at https://learn.telerik.com/.
Hi Anton,
Thank you for the provided code snippets.
To rotate the columns' header, you need to extract and edit the default template of the GridViewHeaderCell. In the extracted template, you can rotate the Grid named PART_HeaderCellGrid to the specified angle. To fix the filter drop-down position, you will need to rotate the filter icon (grid:FilteringDropDown x:Name="PART_DistinctFilterControl") to open its dropdown content vertically. There is Editing Control Templates help article in our documentation, which describes how you can get the default template of the controls. I have prepared an example for you that demonstrates this approach.
The attached project uses XAML binaries, and the extracted template is based on the default one (Office_Black).
As for your second scenario, I am assuming that you have found a solution. Correct me if I am wrong.
Regards,
Dinko
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products, quickly just got a fresh new look + new and improved content, including a brand new Blazor course! Check it out at https://learn.telerik.com/.
[/quote]
Thank you, i'll see