)
We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to trigger the event while deleting an appointment using contextmenu in WinForms ScheduleControl?

Platform: WinForms |
Control: ScheduleControl |
Published Date: January 6, 2017 |
Last Revised Date: January 9, 2020

Delete item in contextmenustrip

There is no default event support for deleting the appointment in ScheduleControl. But this can be achieved by deleting the default delete item in ContextMenuStrip and adding the new custom delete item with the new event.

C#

private ContextMenuStrip strip;
 
//Get the menu items.
strip = this.scheduleControl1.GetScheduleHost().ContextMenuStrip;
 
//Delete the default delete item in ContextMenuStrip. 
strip.Items.RemoveAt(4);
 
//Create a new menu item with event for delete support.
ToolStripItem item = new ToolStripMenuItem("Delete Item", (Image)(ScheduleGrid.GetBitmap("Delete.png")), new EventHandler(deleteItemClick));
 
//Add the new item to ContextMenuStrip.
strip.Items.Insert(4, item);
 
//Customize the event when the item was deleted.
private void deleteItemClick(object sender, EventArgs e)
{
    this.scheduleControl1.PerformDeleteItemClick();
}

VB

Private strip As ContextMenuStrip
 
'Get the menu items.
strip = Me.scheduleControl1.GetScheduleHost().ContextMenuStrip
 
'Delete the default delete item in ContextMenuStrip.
strip.Items.RemoveAt(4)
 
'Create a new menu item with event for delete support.
Dim item As ToolStripItem = New ToolStripMenuItem("Delete Item", CType(ScheduleGrid.GetBitmap("Delete.png"), Image), New EventHandler(AddressOf deleteItemClick))
 
'Add the new item to menu.
strip.Items.Insert(4, item)
 
'Customize the event when the item was deleted.
private void deleteItemClick(Object sender, EventArgs e)
    Me.scheduleControl1.PerformDeleteItemClick()

Samples:

C#: ScheduleControl CS

VB: ScheduleControl VB

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon