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

Set non accessible hours

Thread ID:

Created:

Updated:

Platform:

Replies:

123366 Mar 10,2016 05:34 PM UTC Mar 15,2016 03:53 AM UTC UWP 3
loading
Tags: SfSchedule
Pavel Marius Iulian
Asked On March 10, 2016 05:34 PM UTC

Hi, I'm using Syncfusion Scheduler, and there exist the possibility to block a part of a week for example, or to set the non working hours. My question is: is there any possibility to block just a part froma single day? (Eg. Monday, hours from 08:00 to 12:00 to be blocked, non accessible). I searched in your documentation, but I find that I can block an entire block of hours for entire week and month, or I can block an entire day, or eliminate an explicit day from scheduler. Actually I have to show all days in scheduler, but insteadblocking all specifiedhours onentire week, I have to block just some specified hours on every day. Why I need these, because in every day I will have anotherhours blocked as against the day before. I saw that by appending NonAccessibleBlock with parameters StartHour and EndHour I will block the entire block of specified hours for entire week (if the scheduler is set on week view), or if I will set the NonWorkingDateCollection with a specify day, that day will be hidden from scheduler, witch is not useful for me.
In the image attached at this topic, I willshow you what I exactly wantto do. I would appreciate if there exist a solution.
Thank you!

Attachment: 132_337a79f9.rar

Sanjith Kesavan [Syncfusion]
Replied On March 13, 2016 12:57 PM UTC

Hi Pavel 

Thanks for using Syncfusion product.

As of now we don't have any direct support to set different NonWorkingHours at every day in week view but your requirement can be achieved in sample level by creating custom Appointment with additional fields and AppointmentTemplate. We have prepared sample based on your requirement and please find the sample in the below link.

Sample link: http://www.syncfusion.com/downloads/support/directtrac/general/ze/SfSchedule_UWP-195236942.zip

In the above sample we have added the additional fields to the ScheduleAppointment to create blocking hours by using appointment. Please find the below KB article for more details about creating appointment with additional fields.

KB link: https://www.syncfusion.com/kb/5833/how-to-add-additional-entities-to-the-sheduleappointment-class

In the above sample we have created IsBlockHours propery in the ScheduleAppointment class to create blocking hours using appointment. We have used below code snippet for creating custom appointment in schedule control.

C#:

 

Source = new ScheduleAppointmentCollection

            {

                new CustomAppointment{IsBlockHours=true,Subject="BlockedHours",StartTime=DateTime.Now.Date.AddHours(1),EndTime=DateTime.Now.Date.AddHours(2)},

                new CustomAppointment{IsBlockHours=false,Subject="CheckUp",StartTime=DateTime.Now.Date.AddDays(1).AddHours(1),EndTime=DateTime.Now.Date.AddDays(1).AddHours(8)},

          

            };

            this.DataContext = this;

 

 

We have used below convertors to decrease the opacity of appointment for creating blocked hours and HitTestVisible set to false to stop the user interaction. Please fin the below code snippet for the same.

C#:

 

public class OpacityConvertor : IValueConverter

{

    public object Convert(object value, Type targetType, object parameter, string language)

    {

        var app = value as CustomAppointment;

        if (app.IsBlockHours == true)

            return 0.2;

        else

            return 1;

    }

    public object ConvertBack(object value, Type targetType, object parameter, string language)

    {

        throw new NotImplementedException();

    }

}

public class HitTestVisibleConvertor : IValueConverter

{

    public object Convert(object value, Type targetType, object parameter, string language)

    {

        var app = value as CustomAppointment;

        if (app.IsBlockHours == true)

            return false;

        else

            return true;

    }

    public object ConvertBack(object value, Type targetType, object parameter, string language)

    {

        throw new NotImplementedException();

    }

}

 

 

 

We have also disabled context menu and appointment editor by using ContextMenuOpening and AppointmentEditorOpening event when interacting with the blocked area.

Please let us know if you have any concern.

Regards

Vigneshkumar R


Attachment: SfSchedule_UWP_393504ac.zip

Pavel Marius Iulian
Replied On March 14, 2016 06:24 AM UTC

Thank you for your support. I found your solution helpful. I asked about that because I don't want to put so many appointments in my schedule, but for the moment it is ok.
Thank you very much!

Vigneshkumar Ramasamy [Syncfusion]
Replied On March 15, 2016 03:53 AM UTC

Hi Pavel,

Thanks for your update. Please let us know if you need further assistance on this.

Regards

Vigneshkumar R


CONFIRMATION

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.

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

;