Accessing the Data Object in the TimelineItem Template

2 posts, 0 answers
  1. Sebastian
    Sebastian avatar
    2 posts
    Member since:
    May 2012

    Posted 28 Dec 2012 Link to this post

    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">
                                                        <Rectangle x:Name="timelineItem" Height="29" Stroke="#FFCBCBCB" VerticalAlignment="Center">
                                                                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                                                    <GradientStop Color="#FF4786AA" Offset="0"/>
                                                                    <GradientStop Color="#FF163D59" Offset="1"/>
                                                        <TextBlock Text="{Binding Path=Iteration.Name}"></TextBlock>
  2. Tsvetie
    Tsvetie avatar
    1517 posts

    Posted 28 Dec 2012 Link to this post

    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.

    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top