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

How to Attach Context Menu to Gantt Event Containers


Product Version 2019.2.510
Product RadGanttView for WPF


How to display a context menu for the event container elements of RadGanttView.


Define the context menu on the RadGanttView level and show it only when an EventContainer is clicked. To do this, handle the ContextMenuOpening event.

<telerik:RadGanttView ContextMenuOpening="RadGanttView_ContextMenuOpening"> 
            <telerik:RadMenuItem Header="Click me!" Command="{Binding MyCommand}" /> 

private void RadGanttView_ContextMenuOpening(object sender, ContextMenuEventArgs e) 
    var source = (FrameworkElement)e.OriginalSource; 
    var container = source.ParentOfType<EventContainer>(); 
    if (container == null) 
        e.Handled = true; 
Setting e.Handled = true will cancel the menu opening.

See Also

In this article