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

RadContextMenu with Timeline

1 Answer 56 Views
TimeLine
This is a migrated thread and some comments may be shown as answers.
Josh Eastburn
Top achievements
Rank 1
Josh Eastburn asked on 21 Dec 2012, 04:23 PM
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>

1 Answer, 1 is accepted

Sort by
0
Accepted
Tsvetie
Telerik team
answered on 27 Dec 2012, 01:16 PM
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.

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