RadContextMenu with Timeline

2 posts, 1 answers
  1. Josh Eastburn
    Josh Eastburn avatar
    32 posts
    Member since:
    Aug 2012

    Posted 21 Dec 2012 Link to this post

    I've tried using a RadContextMenu with the RadTimeline, but it doesn't seem like I can get access to the clicked Timeline DataItem through either the Opened or Click events.  Is there another way I can access the item that was clicked on in these events?

    <telerik:RadTimeline x:Name="timelineControl"
                         PeriodStart="{Binding TimelinePeriodStart, Mode=TwoWay}"
                         PeriodEnd="{Binding TimelinePeriodEnd, Mode=TwoWay}"
                         StartPath="StartTime"
                         DurationPath="Duration"
                         GroupPath="BlockId"
                         GroupExpandMode="None"
                         ItemsSource="{Binding TimelineItems}"
                         ItemTemplateSelector="{StaticResource timelineTemplateSelector}"
                         VisiblePeriodStart="{Binding TimelineVisiblePeriodStart, Mode=TwoWay}"
                         VisiblePeriodEnd="{Binding TimelineVisiblePeriodEnd, Mode=TwoWay}">
        <telerik:RadContextMenu.ContextMenu>
            <telerik:RadContextMenu x:Name="TimelineContextMenu" Opened="TimelineContextMenu_OnOpened">
                <telerik:RadMenuItem Click="RadMenuItem_OnClick">
                    <telerik:RadMenuItem.Header>
                        <TextBlock FontSize="14">Remove from Timeline</TextBlock>
                    </telerik:RadMenuItem.Header>
                </telerik:RadMenuItem>
            </telerik:RadContextMenu>
        </telerik:RadContextMenu.ContextMenu>
  2. Answer
    Tsvetie
    Admin
    Tsvetie avatar
    1517 posts

    Posted 27 Dec 2012 Link to this post

    Hello Josh,

    In this case, you can use the GetClickedElement method of RadContextMenu to get the timeline item that was clicked. For example:

    TimelineItemControlBase timelineItem = radContextMenu.GetClickedElement<TimelineItemControlBase>();

    For additional information, please refer to our online documentation and online demos.

    All the best,
    Tsvetie
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. DevCraft banner
Back to Top