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. Image for the cookie policy date

How do we implement Custom View type in Schedule Control?

Hi,

Could you please help me on how to implement Custom View(schedule type) in Schedule control?


Regards,

Mohit saxena

5 Replies

AR Arulpriya Ramalingam Syncfusion Team July 27, 2017 01:02 PM UTC

Hi Mohit, 
 
Thanks for using Syncfusion products. 
 
We could understand your scenario. We regret to let you know that the Schedule control does not have the support for customizing the view but, the appearance of Schedule control can be customized. Already we have provided a UG document for customizing the appearance of Schedule control. Please make use of below UG link, 
 
 
The CustomAppointment Form can be added by using ShowingAppointmentForm event. Please make use of below KB link, 
 
 
Regards, 
Arulpriya 



MO Mohit July 27, 2017 02:17 PM UTC

Hi Arulpriya,

Thank you for sharing the information.

You mean to say ScheduleViewType.CustomWeek is not implemented. If no then, Would you provide support for this feature in the next release?

scheduleControl1.ScheduleType = ScheduleViewType.CustomWeek;


Thanks,
Mohit



MG Mohanraj Gunasekaran Syncfusion Team July 28, 2017 12:32 PM UTC

Hi Mohit,   
  
Sorry for the inconvenience caused.   
  
The ScheduleControl have the support for customizing the week view type. If you want to customize the week in schedule view, you can use the CustomWeek and SelectedDates property. Please refer the below code example and the attached sample,   
  
Code example   
this.scheduleControl1.ScheduleType = ScheduleViewType.CustomWeek;   
   
this.scheduleControl1.Calendar.SelectedDates.Clear();   
DateTime dt = DateTime.Now;   
this.scheduleControl1.Calendar.SelectedDates.AddRange(new DateTime[] { dt, dt.AddDays(1), dt.AddDays(2) });   
this.scheduleControl1.GetScheduleHost().SetDataToDayPanels();   
  
If you would like to add the appointment using AppointForm for CustomWeek, you should use ScheduleAppointmentClick event to show the appointment form based on the CustomWeek view. Please refer to the below code example,   
   
Code example    
private void scheduleControl1_ScheduleAppointmentClick(object sender,ScheduleAppointmentClickEventArgs e)   
{   
    if (e.ClickType == ScheduleAppointmentClickType.LeftDblClick &&this.scheduleControl1.ScheduleType == ScheduleViewType.CustomWeek)   
    {   
        IScheduleAppointment item = e.Item;   
        int colIndex = this.scheduleControl1.GetScheduleHost().CurrentCell.ColIndex;   
        int panel = GetUseTableFromCol(colIndex);   
        bool exist = true;   
        if (item == null)   
        {   
            item = this.scheduleControl1.DataSource.NewScheduleAppointment();   
            exist = false;   
            item.StartTime = e.ClickDateTime;   
            item.EndTime = e.ClickDateTime;   
   
            this.scheduleControl1.GetScheduleHost().ShowAppointmentForm(item, exist, panel);   
            e.Cancel = true;   
        }   
    }   
}   
   
Sample link: ScheduleControl   
  
Regards,   
Mohanraj G   
 



MO Mohit July 28, 2017 01:50 PM UTC

Hi Mohanraj,

I can see a fixed view of custom week in the schedule control. And, I cannot find navigate buttons in caption panel. Is it possible to navigate weeks in this view?


Thanks,

Mohit Saxena



MG Mohanraj Gunasekaran Syncfusion Team July 31, 2017 07:05 AM UTC

Hi Mohit, 
 
Sorry for the inconvenience caused. 
 
In order to navigate the weeks for CustomWeek schedule view, implement the navigation code part manually for ScheduleControl. Please refer to the below code example and the sample, 
 
Code example 
foreach (Control con in this.scheduleControl1.CaptionPanel.Controls) 
{ 
    if (con is ThemedScrollButton) 
    { 
        ThemedScrollButton button = con as ThemedScrollButton; 
        button.Click += button_Click; 
    } 
} 
 
void button_Click(object sender, EventArgs e) 
{ 
    ThemedScrollButton button = sender as ThemedScrollButton; 
            
    if (button.Text == "<")//Move to previous week 
    { 
        this.MoveInDirection(false); 
    } 
    else if (button.Text == ">") //Move to week forward 
    { 
        this.MoveInDirection(true); 
    } 
            
    //Hide display all day events row. 
    this.scheduleControl1.GetScheduleHost().RowHeights[1] = 1;  
} 
 
private void MoveInDirection(bool forward) 
{ 
    if (this.scheduleControl1.ScheduleType == ScheduleViewType.CustomWeek) 
    { 
        DateTime dt = this.scheduleControl1.Calendar.SelectedDates[0]; 
        int count = this.scheduleControl1.Calendar.SelectedDates.Count; 
        dt = dt.AddDays(forward ? count : -count); 
        this.scheduleControl1.Calendar.DateValue = dt; 
        AdjustSelectedDatesByWeek(); 
        //Remove the current cell selection while navigating. 
        this.scheduleControl1.GetScheduleHost().CurrentCell.MoveTo(-1, -1); 
    } 
} 
 
 
private void AdjustSelectedDatesByWeek() 
{ 
    int count = this.scheduleControl1.Calendar.SelectedDates.Count; 
    this.scheduleControl1.Calendar.SelectedDates.BeginUpdate(); 
    DateTime theDate = this.scheduleControl1.Calendar.DateValue; 
    this.scheduleControl1.Calendar.SelectedDates.Clear(); 
   while (count > 0) 
    { 
        this.scheduleControl1.Calendar.SelectedDates.Add(theDate); 
        theDate = theDate.AddDays(1); 
        count--; 
    }   
    this.scheduleControl1.Calendar.SelectedDates.EndUpdate(); 
 
} 
 
Sample link: ScheduleControl 
 
Note 
If you did not see the caption panel in your sample, please ensure the ShowCaption and CaptionPanel.Visible property. Please refer to the below code example, 
 
Code example 
this.scheduleControl1.Appearance.ShowCaption = true; 
this.scheduleControl1.CaptionPanel.Visible = true; 
 
Regards, 
Mohanraj G 
 


Loader.
Up arrow icon