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

GroupPath converter function ?

4 Answers 49 Views
TimeLine
This is a migrated thread and some comments may be shown as answers.
Jean Ressouche
Top achievements
Rank 1
Jean Ressouche asked on 17 Aug 2012, 01:52 PM
Hi, i'm evaluating the possibility to use the timeline component on our app, but the group capability seems a little bit poor (indeed, unlike the gantview for comparaison). is there a way to display in the group part something else than the value used for grouping ?
I would like to group using a int ID, but to display a string (or a more complete usercontrol!). Seems logic to me to ducplicate as group only an id instead of the wanted display string.

Any idea ? Template hack ?

Cordially,
Jean

4 Answers, 1 is accepted

Sort by
0
Accepted
Tsvetie
Telerik team
answered on 23 Aug 2012, 07:03 AM
Hi Jean,

You can use the style of the TimelineItemGroupControl type to achieve this result. For example, in case you just want to change the display string, you can specify it using the Header property and a converter:

<Style TargetType="timelines:TimelineItemGroupControl" BasedOn="{StaticResource TimelineItemGroupControlStyle}">
    <Setter Property="Header" Value="{Binding DataItems, Converter={StaticResource headerTextConverter}}" />
</Style>

You can extract the business object from the first item in DataItems in the converter the following way:
MyBusinessType dataItem = this.DataItems.First().DataItem as MyBusinessType;

In case you want to change the header template, you can customize it using the HeaderTemplate property. For example:
<Style TargetType="timelines:TimelineItemGroupControl" BasedOn="{StaticResource TimelineItemGroupControlStyle}">
    <Setter Property="HeaderTemplate">
        <Setter.Value>
            <DataTemplate>
                <Grid Margin="0,5,0,0">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="*" />
                    </Grid.ColumnDefinitions>
                    <TextBlock Grid.Column="0" Text="{Binding}" Margin="4 0 0 0" HorizontalAlignment="{Binding Path=HorizontalContentAlignment, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type timelines:TimelineItemGroupControl}}}"></TextBlock>
                    <Path Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Stretch" Data="M0,0 L800,0" Height="{StaticResource Timeline_TimelineItemGroup_Separator_Height}" Margin="5 1 0 0" Stretch="Fill" Stroke="{StaticResource Timeline_TimelineItemGroup_Separator_Stroke}" />
                </Grid>
            </DataTemplate>
        </Setter.Value>
    </Setter>
    <Setter Property="Header" Value="{Binding DataItems, Converter={StaticResource headerTextConverter}}" />
</Style>

For additional information on customizing the Styles of out controls, please refer to the following help topic - http://www.telerik.com/help/silverlight/styling-apperance-implicit-styles-overview.html.

Kind regards,
Tsvetie
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Jean Ressouche
Top achievements
Rank 1
answered on 23 Aug 2012, 08:07 AM
Seems perfect, thanks !
0
Josh Eastburn
Top achievements
Rank 1
answered on 20 Dec 2012, 03:44 PM
Has something changed with the TimelineItemGroupControl in the latest version of the RadTimeline?

I am using a custom version of Telerik.Windows.Controls.DataVisualization.xaml and I know my configuration is working because I was able to add a custom vertical ScrollViewer on the timeline in this same file.

But any changes I try to make in the TimelineItemGroupControl similar to those posted above have no effect.  I have tried making changes to the included style, and even a hard-coded Header value has no effect:

<Style TargetType="timelines:TimelineItemGroupControl" BasedOn="{StaticResource TimelineItemGroupControlStyle}">
    <Setter Property="Header" Value="This doesn't work!"></Setter>
</Style>


Thanks,
Josh
0
Tsvetie
Telerik team
answered on 21 Dec 2012, 03:50 PM
Hello Josh,

Yes, you are correct - you cannot use the XAML solution that I posted before with Q3 2012. This is a result of a bugfix. I will log the problem that you have run into.

For the time being, you can use the same approach with the converter in the Template of the TimelineItemGroupControlStyle - simply change all TemplateBindings to the Header property with the new Binding expressing with converter.

All the best,
Tsvetie
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
TimeLine
Asked by
Jean Ressouche
Top achievements
Rank 1
Answers by
Tsvetie
Telerik team
Jean Ressouche
Top achievements
Rank 1
Josh Eastburn
Top achievements
Rank 1
Share this question
or