ColumnGroup text not wrapping automatically

4 posts, 0 answers
  1. Nemanja
    Nemanja avatar
    27 posts
    Member since:
    Mar 2011

    Posted 25 Jan 2012 Link to this post


    I've implemented the ColumnGroups feature on a grid and it works well enough, but I'm running into a problem when the header of the column group exceeds the width of the actual group and it runs over the borders instead of wrapping onto a new line.

    There isn't much documentation available on the ColumnGroups as far as I can see, so I'm not sure how we can get around that? Is there a style setting that we can use in the HeaderStyle or is there another way to do it?

  2. Pavel Pavlov
    Pavel Pavlov avatar
    2039 posts

    Posted 30 Jan 2012 Link to this post

    Hello Nemanja,

    Here is how you can achive the desired result . The important code is in yellow.
    <telerik:RadGridView >
                    <telerik:GridViewColumnGroup Name="Group1" Header="Lorem Ipsum Dolor sin amet">
                                <TextBlock Text="{Binding }"  TextWrapping="Wrap" />
                    <telerik:GridViewColumnGroup Name="Group2" Header="Group2"/>
                    <telerik:GridViewColumn Width="50" ColumnGroupName="Group1" />
                    <telerik:GridViewColumn Width="50" ColumnGroupName="Group1" />
                    <telerik:GridViewColumn ColumnGroupName="Group2" />
                    <telerik:GridViewColumn ColumnGroupName="Group2" />

    Please be sure to use the latest dlls (the ones from our latest internal build ) as they contain some relevant fixes.

    I am attaching a runnable project with the code above as well

    Pavel Pavlov
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. Nemanja
    Nemanja avatar
    27 posts
    Member since:
    Mar 2011

    Posted 30 Jan 2012 Link to this post

    Hi Pavel,

    Thanks for this, that's exactly what I was looking for. The only issue now is that we have a global style throughout our application that applies to all column header groups. How would one put that template in the style? The CommonColumnHeader doesn't have a HeaderTemplate property.

    Here is the style we have at present, how do we add the text wrap option to it?

    <Style x:Key="RadGridViewHeaderGroupStyle" TargetType="{x:Type rad:CommonColumnHeader}">
            <Setter Property="HorizontalContentAlignment" Value="Center" />
            <Setter Property="BorderThickness" Value ="0,0,1,1"/>
            <Setter Property="BorderBrush" Value ="#FF83A5D2"/>
            <Setter Property="Background">
                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                        <GradientStop Color="#FFEBF3FF" Offset="0"/>
                        <GradientStop Color="#FFD0E8FF" Offset="1"/>
                        <GradientStop Color="#FFABC9EE" Offset="0.43"/>
                        <GradientStop Color="#FFC6DFFF" Offset="0.42"/>
  4. F Beto
    F Beto avatar
    11 posts
    Member since:
    Nov 2012

    Posted 05 Sep 2013 Link to this post

    Hello Pavel,

    I have a almost the same problem but with GridViewHyperlinkColumn, TextWrapping="Wrap" doesn't work!
    I have attached an image. Could you help me? I am using Telerik controls 2013 Q1

    Thanks in advance.
Back to Top