Remove Sunday From Weekview

6 posts, 0 answers
  1. Scott
    Scott avatar
    4 posts
    Member since:
    Oct 2012

    Posted 08 Dec 2014 Link to this post

    I don't want to show Sunday in WeekView. How can I hide days of the week?
  2. Hristo Merdjanov
    Admin
    Hristo Merdjanov avatar
    712 posts

    Posted 10 Dec 2014 Link to this post

    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.

     
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Scott
    Scott avatar
    4 posts
    Member since:
    Oct 2012

    Posted 10 Dec 2014 in reply to Hristo Merdjanov Link to this post

    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);
        }
  5. Hristo Merdjanov
    Admin
    Hristo Merdjanov avatar
    712 posts

    Posted 13 Dec 2014 Link to this post

    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.

     
  6. Mary
    Mary avatar
    12 posts
    Member since:
    Jul 2014

    Posted 27 Apr 2015 in reply to Hristo Merdjanov Link to this post

    Hi Hristo,

     

    Can this be applied to DayView and TimelineView too?

  7. Hristo Merdjanov
    Admin
    Hristo Merdjanov avatar
    712 posts

    Posted 30 Apr 2015 Link to this post

    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.

     
Back to Top
UI for WinForms is Visual Studio 2017 Ready