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

Grouping by Object and custom group header

2 Answers 166 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Massimo asked on 21 Oct 2014, 01:23 PM
Hi, I'm grouping my list of values from an object. 
This object might be one of these 3 classes: Class1, Calss2, Calss3. This is working.

I followed your sample: for a custom header template.

But when I'm selecting the template from each group header I find the string "Class1", "Calss2", "Calss3" instead of its real value.

What am I doing wrong? Am I missing something?

2 Answers, 1 is accepted

Sort by
Top achievements
Rank 1
answered on 21 Oct 2014, 01:56 PM
Ok, it might be rude, but it's working so far:

<Style x:Key="TimelineItemGroupControlStyle1" TargetType="timelines:TimelineItemGroupControl" BasedOn="{StaticResource TimelineItemGroupControlStyle}">
    <Setter Property="Template">
            <ControlTemplate TargetType="timelines:TimelineItemGroupControl">
                <Border Background="{TemplateBinding Background}"
                    BorderBrush="{TemplateBinding BorderBrush}"
                    BorderThickness="{TemplateBinding BorderThickness}">
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="*" />
                        <Grid x:Name="Header" Grid.Row="0" Margin="0 5 0 0"
                                        Visibility="{Binding Path=HasHeader, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource booleanToVisibilityConverter}}">
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="*" />
                            <ContentControl Grid.Column="0"
                                            Content="{Binding DataGroups[0].DataItems[0].Group}"
                                            ContentTemplate="{TemplateBinding HeaderTemplate}"
                                            ContentTemplateSelector="{StaticResource headerTemplateSelector}">
                            <Path Grid.Column="1"
                                                Data="M0,0 L800,0"
                                                Height="{StaticResource Timeline_TimelineItemGroup_Separator_Height}"
                                                Margin="5 1 0 0"
                                                Stroke="{StaticResource Timeline_TimelineItemGroup_Separator_Stroke}" />
                        <ItemsPresenter x:Name="Content" Grid.Row="1" />
<Style TargetType="timelines:TimelineItemGroupControl" BasedOn="{StaticResource TimelineItemGroupControlStyle1}">
    <Setter Property="IsExpanded" Value="True" />
Martin Ivanov
Telerik team
answered on 24 Oct 2014, 12:58 PM
Hello Massimo,

I am glad to hear that you achieved your requirement.

Note that whatever object you pass as a Header of the timeline groups through the RadTimeline's GroupPath property, the returned value from the object's ToString() value will be used as a value of the Header property. 

The approach you are currently using is fine for your requirement. Another approach could be to override the ToString() method of your objects and return a proper value.


Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

Asked by
Top achievements
Rank 1
Answers by
Top achievements
Rank 1
Martin Ivanov
Telerik team
Share this question