New to Telerik UI for WPF? Download free 30-day trial

How to determine what group was clicked inside

Environment

Product RadTimeline for WPF

Description

How to determine which timeline group was clicked.

Solution

Handle the MouseRightButtonDown/MouseLeftButtonDown event of the RadTimeLine and check, if the clicked element is a TimelineItemGroupControl.

Example 1: Checking the clicked element

private void RadTimeline_MouseRightButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e) 
{ 
    var panel = e.OriginalSource as VirtualizingTimelinePanel; 
    if (panel != null) 
    { 
        var groupControl = panel.ParentOfType<TimelineItemGroupControl>(); 
        if (groupControl != null) 
        { 
            var context =  (TimelineDataItemGroup)groupControl.DataContext; 
        } 
    } 
} 
Private Sub RadTimeline_MouseRightButtonDown(ByVal sender As Object, ByVal e As System.Windows.Input.MouseButtonEventArgs) 
    Dim panel = TryCast(e.OriginalSource, VirtualizingTimelinePanel) 
    If panel IsNot Nothing Then 
        Dim groupControl = panel.ParentOfType(Of TimelineItemGroupControl)() 
        If groupControl IsNot Nothing Then 
            Dim context = CType(groupControl.DataContext, TimelineDataItemGroup) 
        End If 
    End If 
End Sub 

See Also

In this article
Not finding the help you need? Improve this article