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: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Click on weeknumber -> change to Worweek view

Thread ID:





69003 Oct 9,2007 09:56 AM UTC Sep 12,2018 08:58 AM UTC WinForms 7
Tags: ScheduleControl
Samy Abou-Shama
Asked On October 9, 2007 09:56 AM UTC


when one clicks the week number in the calendar, the week is displayed in the ScheduleViewType.Week.
Is it possible to change this behaviour, so that the view type is ScheduleViewType.WorkWeek instead?

Thank you for you help.

Samy Abou-Shama

Administrator [Syncfusion]
Replied On October 10, 2007 01:45 PM UTC

There is no event or property you can set to get this behavior.

So for now, you would have to get at the embedded GridControl that is in the NavigationCalendar. This requires deriving the ScheduleControl, NavigationCalendar and GridControl. You need to derive the first 2 classes just to create the proper instance of the latter 2 classes.

Inside the GridControl, you would override OnClick and catch the clicks there. If the click is on the month header, you would switch to the MonthView and if the click is on the week number, you would switch to the workweek view. In both cases, you set e.Cancel = true and not call the base class to prevent the default behavior from occurring. It takes little work to do this. Here is a minimal sample that attempts it.


Felix Bagur
Replied On September 4, 2018 09:15 AM UTC

In the current version there is a simpler solution? I have tried the example but it does not work correctly.


Mohanraj Gunasekaran [Syncfusion]
Replied On September 5, 2018 12:49 PM UTC

Hi Felix,  
Thanks for using Syncfusion product.  
To avoid the view changing while clicking on the week number, you could disable the SwitchViewStyle property. Please refer the following code example,  
Code example  
//To handle the view changing of scheduleControl.  
this.scheduleControl1.SwitchViewStyle = false;  
If you want to change the schedule view using ScheduleControl context menu. You could use the CalenderGrid.MouseDown and ScheduleContextMenuClick event to handle the SwitchViewStyle property. Please refer the following code example and the sample,  
Code example  
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;  
Mohanraj G 

Felix Bagur
Replied On September 5, 2018 12:57 PM UTC

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,


Arulraj A [Syncfusion]
Replied On September 6, 2018 09:15 AM UTC

Sorry for the inconvenience caused. 
To avoid the view changing while clicking on the week number, you could handle the CalendarGrid.CellClick event. Please refer the following code example and the sample, No need to disable the SwitchViewStyle property. 
Code example 
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); 
            if (this.scheduleControl1.ScheduleType == ScheduleViewType.Day) 
                this.scheduleControl1.Calendar.SelectedDates[0] = dateValue; 
            this.scheduleControl1.GetScheduleHost().SwitchTo(ScheduleViewType.WorkWeek, true); 
        e.Cancel = true; 
Arulraj A 

Felix Bagur
Replied On September 12, 2018 07:16 AM UTC

Thanks for you update!, it works!

Mohanraj Gunasekaran [Syncfusion]
Replied On September 12, 2018 08:58 AM UTC

Thanks for your update. 
We are glad to know that your reported problem has resolved. 
Please let us know if you have any concerns. 
Mohanraj G 


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

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

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