Hi v Gian Piero Truccolo,
Greetings from Syncfusion.
We have checked the reported query and we have achieved as per below
The context menu for a selected node will display by using the Gantt control SelectedItems CollectionChanged, as shown in the following code snippet:
Code snippet [C#]:
|
public MainWindow()
{
InitializeComponent();
this.Gantt.SelectedItems.CollectionChanged += SelectedItems_CollectionChanged;
}
private void SelectedItems_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
{
if (e.Action == NotifyCollectionChangedAction.Add)
{
contextMenu.Items.Clear();
contextMenu.Items.Add(new MenuItem() { Header = "Node pressed" });
contextMenu.Items.Add(new MenuItem() { Header = "Node pressed" });
}
} |
The context menu for the Gantt chart will display by using the Gantt control MouseRightButtonDown event, as shown in the following code snippet:
Code snippet [XAML]:
|
<sync:GanttControl x:Name="Gantt" GridWidth="0" MouseRightButtonDown="Gantt_MouseRightButtonDown"
ItemsSource="{Binding TaskCollection}"
UseAutoUpdateHierarchy="False"
VisualStyle="Metro">
...
<sync:GanttControl.ContextMenu>
<ContextMenu x:Name="contextMenu" BorderBrush="Black" BorderThickness="1" >
</ContextMenu>
</sync:GanttControl.ContextMenu>
</sync:GanttControl>
|
[C#]:
|
private void Gantt_MouseRightButtonDown(object sender, MouseButtonEventArgs e)
{
contextMenu.Items.Clear();
contextMenu.Items.Add(new MenuItem() { Header = "Chart pressed" });
} |
Let us know if you need any further assistance.
Regards,
Sridevi S.