How to Hook an Event for WinForms ScheduleControl?
Hook an event for context menu
To hook an
event for WinForms ScheduleControl context
menu can be done by item_Click event. When we right click on
the context menu strip of schedule control, we can know which item has clicked
by using item_Click event.
C#
foreach (MenuItem item in this.scheduleControl1.GetScheduleHost().ContextMenu.MenuItems)
{
item.Click += item_Click;
}
private void item_Click(object sender, EventArgs e)
{
MenuItem item = sender as MenuItem;
MessageBox.Show( item.Text +" Item clicked");
}
For Each item As MenuItem In Me.scheduleControl1.GetScheduleHost().ContextMenu.MenuItems
AddHandler item.Click, AddressOf item_Click
Private Sub item_Click(ByVal sender As Object, ByVal e As EventArgs)
Dim item As MenuItem = TryCast(sender, MenuItem)
MessageBox.Show(item.Text & "Item clicked")
End Sub
Samples:
C#: Click event
VB: Click event
Conclusion
I hope you enjoyed learning about how to hook an event for ScheduleControl.
You can refer to our WinForms ScheduleControl feature tour page to know about its other groundbreaking feature representations and WinForms ScheduleControl documentation, and how to quickly get started for configuration specifications. You can also explore our WinForms ScheduleControl example to understand how to present and manipulate data.
For current customers, you can check out our WinForms from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our WinForms GridListControl and other WinForms components.
If you have any queries or require clarifications, please let us know in comments below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!