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">
                                                    <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>
  2. Tsvetie
    Admin
    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.

    Greetings,
    Tsvetie
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. UI for WPF is Visual Studio 2017 Ready
Back to Top