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

Group header Text wrapping

5 Answers 91 Views
TileList
This is a migrated thread and some comments may be shown as answers.
Daní
Top achievements
Rank 1
Daní asked on 19 Sep 2013, 10:28 AM
Hi,

How can I wrap texts in Group Headers?

Thanks

5 Answers, 1 is accepted

Sort by
0
Accepted
Vanya Pavlova
Telerik team
answered on 19 Sep 2013, 12:44 PM
Hi Dani,

 

The easiest way to achieve this result is to predefine GroupHeaderTemplate to a single column or to the whole RadGridView, as follows:

<telerik:RadGridView  ItemsSource="{Binding Collection}">
        <telerik:RadGridView.Columns>
            <telerik:GridViewDataColumn DataMemberBinding="{Binding Property1}">
                <telerik:GridViewDataColumn.GroupHeaderTemplate>
                    <DataTemplate>
                        <TextBlock Width="100" TextWrapping="Wrap" Text="Wrappppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp"/>
                        </DataTemplate>
                    </telerik:GridViewDataColumn.GroupHeaderTemplate>
                </telerik:GridViewDataColumn>
            </telerik:RadGridView.Columns>
        </telerik:RadGridView>

Regards,
Vanya Pavlova
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Daní
Top achievements
Rank 1
answered on 19 Sep 2013, 01:59 PM
I mean Group fo RadTileList, not RadGridView


thanks
0
Maya
Telerik team
answered on 19 Sep 2013, 03:25 PM
Hello Dani,

You can follow the exact same approach - set the TextWrapping property and desired Width to the TextBlock used as GroupTemplate. For example:

<DataTemplate x:Key="groupTemplate">
                    <TextBlock  Text="{Binding}" TextWrapping="Wrap" />
                </DataTemplate>
 
 
<telerik:RadTileList x:Name="tileList"
                             GroupTemplate="{StaticResource groupTemplate}" >
 

Regards,
Maya
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Daní
Top achievements
Rank 1
answered on 20 Sep 2013, 08:52 AM
Hi Maya,

I already tried this approach but it's not working. The only way I've found to wrap text in group header is by fixing TextBlock width. I have modified one of your demos to demonstrate the issue:

<UserControl x:Class="RadTileList_Groups.MainPage"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
             xmlns:my="clr-namespace:RadTileList_Groups"
             mc:Ignorable="d" d:DesignHeight="700" d:DesignWidth="700">
    <Grid>
        <Grid.Resources>
            <DataTemplate x:Key="GroupTemplate">              
                    <TextBlock Text="{Binding}"
                               Margin="5,0,0,5"
                               FontWeight="Bold" TextWrapping="Wrap"/>              
            </DataTemplate>
            <Style TargetType="telerik:Tile">
                <Setter Property="Margin" Value="5,15,5,0"/>
                <Setter Property="Background" Value="#A500AD"/>
            </Style>
        </Grid.Resources>
        <telerik:RadTileList x:Name="RadTileList"
                             ScrollViewer.HorizontalScrollBarVisibility="Visible"
                             GroupTemplate="{StaticResource GroupTemplate}" >
            <telerik:Tile Group="Continent very large, large large and large, and large, and large and dndnddndn" TileType="Single">
                <TextBlock Text="Europe"/>
            </telerik:Tile>
            <telerik:Tile  Group="Country" TileType="Single">
                <TextBlock Text="Germany"/>
            </telerik:Tile>
            <telerik:Tile Group="Continent" TileType="Single">
                <TextBlock Text="Asia"/>
            </telerik:Tile>
            <telerik:Tile  Group="Country" TileType="Single">
                <TextBlock Text="Italy"/>
            </telerik:Tile>
        </telerik:RadTileList>
    </Grid>
</UserControl>
0
Maya
Telerik team
answered on 20 Sep 2013, 02:54 PM
Hello Dani,

TextWrapping will be applied when the space available for the TextBlock finishes. That being set, if TextBlock can stretch to infinity, the text will never be wrapped. In such cases, you need to set Width/ MaxWidth property. 

Regards,
Maya
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
TileList
Asked by
Daní
Top achievements
Rank 1
Answers by
Vanya Pavlova
Telerik team
Daní
Top achievements
Rank 1
Maya
Telerik team
Share this question
or