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

Accessing the Data Object in the TimelineItem Template

1 Answer 70 Views
TimeLine
This is a migrated thread and some comments may be shown as answers.
Sebastian
Top achievements
Rank 1
Sebastian asked on 28 Dec 2012, 11:35 AM
I'm trying to display some of the Data as Text in my TimelineItems, but all my Template can access is an Object of type TimelineDataItem

System.Windows.Data Error: 40 : BindingExpression path error: 'Iteration' property not found on 'object' ''TimelineDataItem'

TimelineDataItem has no Property that holds the original value object. In the ToolTip I can access the original Data object, though.
Can anyone tell me please how I can get the original Data in the template?

                                        <ControlTemplate TargetType="{x:Type telerik:TimelineItemControl}">
                                            <Border Background="#01FFFFFF" Height="30" Margin="0,5,0,0">
                                                <Grid>
                                                    <Rectangle x:Name="timelineItem" Height="29" Stroke="#FFCBCBCB" VerticalAlignment="Center">
                                                        <Rectangle.Fill>
                                                            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                                                <GradientStop Color="#FF4786AA" Offset="0"/>
                                                                <GradientStop Color="#FF163D59" Offset="1"/>
                                                            </LinearGradientBrush>
                                                        </Rectangle.Fill>
                                                    </Rectangle>
                                                    <TextBlock Text="{Binding Path=Iteration.Name}"></TextBlock>
                                                </Grid>
                                            </Border>
                                        </ControlTemplate>

1 Answer, 1 is accepted

Sort by
0
Tsvetie
Telerik team
answered on 28 Dec 2012, 03:52 PM
Hello Sebastian,

You can access the business object that a timeline item represents using the DataItem property of TimelineDataItem. For example:

<TextBlock Text="{Binding Path=DataItem.Iteration.Name}"></TextBlock>

This is demonstrated in our First Look demo.

Greetings,
Tsvetie
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
TimeLine
Asked by
Sebastian
Top achievements
Rank 1
Answers by
Tsvetie
Telerik team
Share this question
or