Grouping by Object and custom group header

3 posts, 0 answers
  1. Massimo
    Massimo avatar
    26 posts
    Member since:
    Apr 2013

    Posted 21 Oct 2014 Link to this post

    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. Massimo
    Massimo avatar
    26 posts
    Member since:
    Apr 2013

    Posted 21 Oct 2014 in reply to Massimo Link to this post

    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" />
  3. Martin Ivanov
    Martin Ivanov avatar
    1408 posts

    Posted 24 Oct 2014 Link to this post

    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.

Back to Top