Hi
I can't find the way to pass to my customized form AppointmentForm the end time of the selected interval, for example in my picture (12:00)
I can only detect the time when I click thanks to the scheduleControl1_ScheduleAppointmentClick event and e.ClickDateTime. Also, how can I increase the width of the calendar that appears to be cut off? (please see the picture attached)
Thank you in advance,
Claudio
I can't find the way to pass to my customized form AppointmentForm the end time of the selected interval, for example in my picture (12:00)
I can only detect the time when I click thanks to the scheduleControl1_ScheduleAppointmentClick event and e.ClickDateTime. |
By default, the start and end time of the selected ranges will be added in the Appointment form when the form is opened. In order to open get the start and end date time, the AppointmentShowing event will be used and in which, the StartTime and EndTime of the item can be used. Please refer to the below code.
Code example
//Event subscription
scheduleControl1.ShowingAppointmentForm += ScheduleControl1_ShowingAppointmentForm;
//Event customization
private void ScheduleControl1_ShowingAppointmentForm(object sender, ShowingAppointFormEventArgs e)
{
DateTime startTime = e.Item.StartTime;
DateTime endTime = e.Item.EndTime;
//code perform actions with start and end time.
}
Note : The appointment form will be displayed by right clicking on the selected range and selecting the New Item menu.
|
Also, how can I increase the width of the calendar that appears to be cut off? (please see the picture attached) |
In order to change the width for the Calender of the ScheduleControl, the NavigationPanel width can be used. Please make use of the below code and sample.
Code example
//To chage the calender width.
this.scheduleControl1.NavigationPanel.Width = 300;
|
void scheduleControl1_ShowingAppointmentForm(object sender, ShowingAppointFormEventArgs e)
{
//To update the DateTime in custom form
form.NewItem = e.Item;
//Cancel the default appointform for schedule control
e.Cancel = true;
//Shows the Custom appointment form
form.ShowDialog();
}
//In AppointmentForm class file
private void AppointmentForm_Load1(object sender, EventArgs e)
{
this.StartDateDateTimePickerAdv.Value = NewItem.StartTime.Date;
this.StartTimeDateTimePickerAdv.Value = NewItem.StartTime;
this.EndDateDateTimePickerAdv.Value = NewItem.EndTime.Date;
this.EndTimeDateTimePickerAdv.Value = NewItem.EndTime;
}
public IScheduleAppointment NewItem
{
get;set;
} |
Hi
Claudio,
Sorry
for the inconvenience.
The
custom AppointmentForm is directly shown when the AddAppointment menu item is
clicked in the provided sample. So, the NewItem is not updated with start and
end time. In order to overcome this scenario, the PerformNewItemClick method of ScheduleControl can be called when
the AddAppointment menu button is clicked. So, the NewItem will be updated with
item start and end time details. We have modified the sample as per your
requirement and please make use of the below code sample.
Code example
void
item_Click(object sender, EventArgs e) { //To update the new item when
the empty range is clicked to add appointment. this.scheduleControl1.PerformNewItemClick(); //if (form != null) //{ // form.ShowDialog(); //} } void
scheduleControl1_ShowingAppointmentForm(object
sender, ShowingAppointFormEventArgs e) { //To update the DateTime in
custom form form.NewItem = e.Item; //Cancel the default
appointform for schedule control e.Cancel = true; //Shows the Custom appointment
form form.ShowDialog(); } |
Sample link: https://www.syncfusion.com/downloads/support/directtrac/general/ze/CS-714958731
Please
get back to us, if you need any further assistance.
Regards,
Arulpriya
//Event triggering
this.scheduleControl1.ScheduleGridCreated += ScheduleControl1_ScheduleGridCreated;
scheduleControl1.SetupContextMenu += ScheduleControl1_SetupContextMenu;
private void ScheduleControl1_SetupContextMenu(object sender, CancelEventArgs e)
{
e.Cancel = true;
//To set the context menu for grid
this.scheduleControl1.GetScheduleHost().ContextMenu = menu;
} |