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

GridView Change Header Height and Wrapping

3 Answers 258 Views
GridView
This is a migrated thread and some comments may be shown as answers.
John Hubbard
Top achievements
Rank 1
John Hubbard asked on 20 Aug 2010, 06:38 PM
Hello,

I am using the Telerik RadGridView control with Silverlight 4.
I need to use two lines for some column headers, so I can fit in long header captions.

To to this, I am trying to set some attributes for the Header, so the Height property is "40" and the TextWrapping property is "Wrap".
I have searched the samples in this section of the forum and have come up with this:


<

 

 

UserControl x:Class="Telerik_GridView.MainPage"

 

 

 

xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

 

 

 

xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

 

 

 

xmlns:d="http://schemas.microsoft.com/expression/blend/2008"

 

 

 

xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"

 

 

 

mc:Ignorable="d"

 

xmlns

 

 

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

 

 

 

d:DesignWidth="700" d:DesignHeight="400">

 

 

 

 


<
telerik:RadGridView x:Name="radGridView1" AutoGenerateColumns="False" ShowGroupPanel="False">

 

 

 

 

    <telerik:RadGridView.HeaderRowStyle>

 

 

 

 

        <Style TargetType="telerik:GridViewHeaderRow">

 

 

 

 

            <Setter Property="Height" Value="40" />

 

 

 

 

            <Setter Property="TextWrapping" Value="Wrap" />

 

 

 

 

        </Style>

 

 

 

 

    </telerik:RadGridView.HeaderRowStyle>

 

 

 

 

 


    <
telerik:RadGridView.Columns>

 

 

 

 

        <telerik:GridViewDataColumn Header="Data 1" Width="80" DataMemberBinding="{Binding Path=Data1}" />

 

 

 

 

        <telerik:GridViewDataColumn Header="Data 2 Long Header" Width="80" DataMemberBinding="{Binding Path=Data2}" />

 

 

 

 

    </telerik:RadGridView.Columns>

 

 

 

 

</telerik:RadGridView>

 

</

 

 

UserControl>

 


It compiles successfully, but generates an error of "Xaml Parse Exception", "Failed to create a 'System.Type' from the text 'telerik:GridViewHeaderRow'.

Could you please show me how to increase the height of the column headers and set the text to wrapping?

Thank you in advance for your help.

John


3 Answers, 1 is accepted

Sort by
0
Vanya Pavlova
Telerik team
answered on 24 Aug 2010, 02:57 PM
Hello John Hubbard,

You cannot use TextWrapping in GridViewHeaderRow, but you can use in in GridViewHeaderCells-If you want to enable TextWrapping in GridViewHeaderCells and using Header property of  the GridViewHeaderCells,where you can place a TextBlock and set its TextWrapping property to Wrap. You can check this how-to help topic.

To increase the height of GridViewHeaderRow you can also use the extension method ChildrenOfType of the RadGridView.
Please see the following thread. and let me know if you need any additional information.

Sincerely yours,
Vanya Pavlova
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
Brian
Top achievements
Rank 1
answered on 05 Jan 2011, 11:20 PM
The example in the help topic causes an exception when my user control that contains my grid gets loaded:

Failed to create a 'System.Windows.Style' from the text ''

This is the relevant xaml

<
telerikGridView:GridViewDataColumn DataMemberBinding="{Binding RequiredForAgent}" Width="Auto" TextAlignment="Right" >
    <telerikGridView:GridViewDataColumn.Header>
        <TextBlock  Text="Required For Agent After Reduction" TextWrapping="Wrap"/>
    </telerikGridView:GridViewDataColumn.Header>
</telerikGridView:GridViewDataColumn>
0
Brian
Top achievements
Rank 1
answered on 05 Jan 2011, 11:32 PM
Never mind, I accidentally added an empty HeaderRowStyle attribute to the grid.
Tags
GridView
Asked by
John Hubbard
Top achievements
Rank 1
Answers by
Vanya Pavlova
Telerik team
Brian
Top achievements
Rank 1
Share this question
or