windowsforms-devexpress-dot-xtragantt-dot-ganttcontrol-101d20b0.md
Fires when a context menu for a task is about to be shown.
Namespace : DevExpress.XtraGantt
Assembly : DevExpress.XtraGantt.v25.2.dll
NuGet Package : DevExpress.Win.Gantt
[DXCategory("Events")]
public event GanttTaskPopupMenuShowingEventHandler TaskPopupMenuShowing
<DXCategory("Events")>
Public Event TaskPopupMenuShowing As GanttTaskPopupMenuShowingEventHandler
The TaskPopupMenuShowing event's data class is GanttTaskPopupMenuShowingEventArgs. The following properties provide information specific to this event:
| Property | Description |
|---|---|
| Cancel | Gets or sets a value indicating whether the event should be canceled. Inherited from CancelEventArgs. |
| Info | Provides access to view information about the task. |
| Items | Provides access to menu items. |
| Node | Gets the node in the tree area for which the menu is about to be shown. |
The code below shows how to populate the context menu with items.
using DevExpress.XtraEditors;
using DevExpress.XtraGantt;
private void ganttControl1_TaskPopupMenuShowing(object sender, GanttTaskPopupMenuShowingEventArgs e) {
e.Items.Add(new DevExpress.Utils.Menu.DXMenuItem("Show Text", (ss, ee) => { XtraMessageBox.Show(e.Node.GetText()); }));
}
Imports DevExpress.XtraEditors
Imports DevExpress.XtraGantt
Private Sub ganttControl1_TaskPopupMenuShowing(ByVal sender As Object, ByVal e As GanttTaskPopupMenuShowingEventArgs) _
Handles ganttControl1.TaskPopupMenuShowing
e.Items.Add(New DevExpress.Utils.Menu.DXMenuItem("Show Text", Sub(ss, ee)
XtraMessageBox.Show(e.Node.GetText())
End Sub))
End Sub
See Also