BoldSign®Effortlessly integrate e-signatures into your app with the BoldSign® API. Create a sandbox account!
//To handle the view changing of scheduleControl.
this.scheduleControl1.SwitchViewStyle = false; |
this.scheduleControl1.Calendar.CalenderGrid.MouseDown += CalenderGrid_MouseDown;
this.scheduleControl1.ScheduleContextMenuClick += ScheduleControl1_ScheduleContextMenuClick;
private void ScheduleControl1_ScheduleContextMenuClick(object sender, ScheduleContextMenuClickEventArgs e)
{
if (!this.scheduleControl1.SwitchViewStyle)
this.scheduleControl1.SwitchViewStyle = true;
}
private void CalenderGrid_MouseDown(object sender, MouseEventArgs e)
{
this.scheduleControl1.SwitchViewStyle = false;
} |
Thanks for your quick response,
The problem comes when you click on the week number, not on a calendar day.
Clicking on the week number keeps changing to the whole week even if you have disabled SwitchViewStyle.
I would like to be able to click on a day of the calendar and get the daily view and click on the week number and get the work week.
Thanks a lot,
Fèlix
this.scheduleControl1.Calendar.CalenderGrid.CellClick += CalenderGrid_CellClick;
private void CalenderGrid_CellClick(object sender, Syncfusion.Windows.Forms.Grid.GridCellClickEventArgs e)
{
if (e.ColIndex == 1 && (this.scheduleControl1.ScheduleType == ScheduleViewType.WorkWeek || scheduleControl1.ScheduleType == ScheduleViewType.Day))
{
GridStyleInfo style = this.scheduleControl1.Calendar.CalenderGrid[e.RowIndex, e.ColIndex];
DateTime dateValue;
if (DateTime.TryParse(style.CellValue.ToString(), out dateValue))
{
while (dateValue.DayOfWeek == DayOfWeek.Saturday || dateValue.DayOfWeek == DayOfWeek.Sunday)
{
//To get the week days of current week.
dateValue = dateValue.AddDays(1);
}
this.scheduleControl1.Calendar.SelectedDates.BeginUpdate();
if (this.scheduleControl1.ScheduleType == ScheduleViewType.Day)
this.scheduleControl1.Calendar.SelectedDates[0] = dateValue;
else
{
this.scheduleControl1.Calendar.SelectedDates.Clear();
this.scheduleControl1.Calendar.SelectedDates.Add(dateValue);
}
this.scheduleControl1.Calendar.SelectedDates.EndUpdate();
this.scheduleControl1.GetScheduleHost().SwitchTo(ScheduleViewType.WorkWeek, true);
}
e.Cancel = true;
}
} |