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

Getting selected item via "right click"

1 Answer 494 Views
TimeLine
This is a migrated thread and some comments may be shown as answers.
Pavel
Top achievements
Rank 1
Pavel asked on 25 Oct 2017, 03:39 PM

Is there a way to get the selected item when performing a 'right click" in the Timeline? I have set up a context menu for the elements in my timeline, but

I have no way of getting to the object that was right-clicked. If you left click first and then right-click, I am able to get the selected item, but there appears

to be no method via "right click".

Paul

1 Answer, 1 is accepted

Sort by
0
Vladimir Stoyanov
Telerik team
answered on 26 Oct 2017, 04:11 PM
Hi Pavel,

You can handle the RadContextMenu's Opened event and then get the clicked element with its GetClickedElement method. Then you can set the RadTimeline's SelectedItem to this element's underlying DataItem. Here is an example of how you can do that:

private void RadContextMenu_Opened(object sender, RoutedEventArgs e)
{
            var timelineItemControl = this.radContextMenu.GetClickedElement<TimelineItemControl>();
            var timelineDataItem = timelineItemControl.DataContext as TimelineDataItem;
            this.radTimeline.SelectedItem = timelineDataItem.DataItem;
}

You can also read some more about the Selection in RadTimeline in our documentation.

I hope this is helpful. Let me know if I can be of any further assistance.

Regards,
Vladimir Stoyanov
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Tags
TimeLine
Asked by
Pavel
Top achievements
Rank 1
Answers by
Vladimir Stoyanov
Telerik team
Share this question
or