This is a migrated thread and some comments may be shown as answers.

Remove Sunday From Weekview

5 Answers 195 Views
Scheduler and Reminder
This is a migrated thread and some comments may be shown as answers.
Scott
Top achievements
Rank 1
Scott asked on 09 Dec 2014, 04:23 AM
I don't want to show Sunday in WeekView. How can I hide days of the week?

5 Answers, 1 is accepted

Sort by
0
Hristo
Telerik team
answered on 10 Dec 2014, 09:40 AM
Hello Scott,

Thank you for your interest in our products.

You can manipulate the WorkWeekStart and WorkWeekEnd properties of our SchedulerWeekView class to achieve a custom start/end working time. The code snippet below is an example of how you can use it:
public WeekViewForm()
{
    InitializeComponent();
    this.SetWeekViewPreferences();
}
 
private void SetWeekViewPreferences()
{
    this.radScheduler.ActiveViewType = SchedulerViewType.WorkWeek;
    SchedulerWeekView weekView = this.radScheduler.ActiveView as SchedulerWeekView;
    weekView.WorkWeekStart = DayOfWeek.Monday;
    weekView.WorkWeekEnd = DayOfWeek.Saturday;
 
    WorkTimeExceptionRule exceptionRule = new WorkTimeExceptionRule();
    SchedulerDayViewBase view = this.radScheduler.ActiveView as SchedulerDayViewBase;
    if (view != null)
    {
        var workInterval = weekView.WorkTime;
 
        exceptionRule.StartTime = workInterval.Start;
        exceptionRule.EndTime = workInterval.End;
        exceptionRule.ExceptionStartDate = weekView.StartDate;
        exceptionRule.ExceptionEndDate = weekView.EndDate.AddDays(1);
        exceptionRule.WeekDays = WeekDays.Saturday;
 
        view.WorkTimeExceptions.Add(exceptionRule);
    }
}
 
I hope that this will help you. Should you have further questions do not hesitate to contact us again.

Regards,
Hristo
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Scott
Top achievements
Rank 1
answered on 10 Dec 2014, 04:46 PM
Hristo,

thanks. Would you please explain the need and what is happening in the following code.

    WorkTimeExceptionRule exceptionRule = new WorkTimeExceptionRule();
    SchedulerDayViewBase view = this.radScheduler.ActiveView as SchedulerDayViewBase;
    if (view != null)
    {
        var workInterval = weekView.WorkTime;
 
        exceptionRule.StartTime = workInterval.Start;
        exceptionRule.EndTime = workInterval.End;
        exceptionRule.ExceptionStartDate = weekView.StartDate;
        exceptionRule.ExceptionEndDate = weekView.EndDate.AddDays(1);
        exceptionRule.WeekDays = WeekDays.Saturday;
 
        view.WorkTimeExceptions.Add(exceptionRule);
    }
0
Hristo
Telerik team
answered on 13 Dec 2014, 12:36 PM
Hi Scott,

Thank you for writing back. 

This rule defines an exception to the general work time defined by the WorkTime property.

Generally, the the WorkTime settings just modify the visual appearance of cells in Work Week View to give an indication to the end user that these cells are within working hours. As you can see, the color of cells during working hours is white in the default theme. Applying the rule as set in my previous post will cause the cells for Saturday to change their color as if it is not a working day. Please see the attached screenshots.

I hope that this information is useful. Should you have further questions do not hesitate contact us again.

Regards,
Hristo
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Mary
Top achievements
Rank 1
answered on 27 Apr 2015, 09:13 AM

Hi Hristo,

 

Can this be applied to DayView and TimelineView too?

0
Hristo
Telerik team
answered on 30 Apr 2015, 08:53 AM
Hello Duncan,

Thank you for writing.

By design when the RadScheduler`s active view is set to WorkWeek, you can set its WorkWeekStart and WorkWeekEnd properties and this way skip the required days. 

If your task is to hide particular days my suggestions is that you try with setting the ActiveView to MultiDay view. It would allow you to set intervals and this way achieve the desired result. You can find additional information here: MultiDay view.

I hope this helps. Should you have further questions please do not hesitate to write back.

Regards,
Hristo Merdjanov
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
Tags
Scheduler and Reminder
Asked by
Scott
Top achievements
Rank 1
Answers by
Hristo
Telerik team
Scott
Top achievements
Rank 1
Mary
Top achievements
Rank 1
Share this question
or