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
close icon

Limit number of hours shown in workweek view

In Work Week View..
There is a handy setting Appearance.DivisionsPerHour, which allows me to show only hours...

But, I would like to show a limited number of hours, like every 3 hours (12:00am, 3am, 6, etc...) or even every 6 hours (0,6,12,18,24).

I see no setting for this, is there any way to accomplish  it?

Eric

3 Replies

VK Vinish Kumar K Syncfusion Team December 5, 2012 10:50 AM UTC

Hi Eric Robishaw,

 

Thank you for your interested in Syncfusion products.

 

Query.

Schedule Control.

Showing limited No of hour

DivisionsPerHour is used to divide the hour time period into some segment. If you want to show the limited time hour in Schedule control day view, use the covered range method.

 

Using covered Range you set the range to limited hours. Please try this in your sample. If it doesn’t works for you, please provide some code or sample file. It will helps us to provide better solution.

 

Please let me know if you have further concerns.

 

Regards,

Vinish.



RA Raul replied to Vinish Kumar K August 29, 2017 03:00 PM UTC

Hi Eric Robishaw,

 

Thank you for your interested in Syncfusion products.

 

Query.

Schedule Control.

Showing limited No of hour

DivisionsPerHour is used to divide the hour time period into some segment. If you want to show the limited time hour in Schedule control day view, use the covered range method.

 

Using covered Range you set the range to limited hours. Please try this in your sample. If it doesn’t works for you, please provide some code or sample file. It will helps us to provide better solution.

 

Please let me know if you have further concerns.

 

Regards,

Vinish.


Hi.Could you show me how I should write my code for accomplishing this problem?

 I ha tried to found the covered Range method but I didn´t find it.. My problem with "Numbers of hours shown in workdays view" still on.

Thanks in advance

Raúl



MG Mohanraj Gunasekaran Syncfusion Team August 30, 2017 01:39 PM UTC

Hi Raul, 

Thanks for using Syncfusion product. 

In order to customize the time in WorkWeek schedule view. You can use the CustomScheduleGrid and CustoScheduleControl by inherited from ScheduleGrid and ScheduleControl and override the GetTimeDisplayText method in ScheduleGrid to customize the times. Please refer to the below code example and the sample, 
 
Code example 
public class CustomScheduleGrid : ScheduleGrid 
{ 
    public CustomScheduleGrid(NavigationCalendar calendar, ScheduleControl schedule, DateTime theDate) 
        : base(calendar, schedule, theDate) 
    { 
 
    } 
 
    protected override string GetTimeDisplayText(int rowIndex) 
    { 
        string am = Schedule.Culture.DateTimeFormat.AMDesignator; 
        string pm = Schedule.Culture.DateTimeFormat.PMDesignator; 
        string value = base.GetTimeDisplayText(rowIndex); 
        int time = 0; 
        if (int.TryParse(value.Replace("|" + am, string.Empty).Replace("|" + pm, string.Empty), out time)) 
        { 
            if (time % 3 == 0) 
                return value; 
            else 
                return string.Empty; 
        } 
        else 
            return value; 
 
    } 
} 
 
public class CustomScheduleControl : ScheduleControl 
{ 
    public CustomScheduleControl():base() 
    { 
 
    } 
 
    public override ScheduleGrid CreateScheduleGrid(NavigationCalendar calendar, ScheduleControl schedule, DateTime initialDate) 
    { 
        ////raise an event to allow listeners to subscribe to grid events or use a derived ScheduleGrid 
        ScheduleGridCreatedEventArgs e = new ScheduleGridCreatedEventArgs(calendar, schedule, initialDate); 
        OnScheduleGridCreated(e); 
        if (e.Handled && e.Grid != null) 
        { 
            return e.Grid; 
       } 
 
        return new CustomScheduleGrid(calendar, schedule, initialDate); 
    } 
} 
 
Screenshot 
 
 
Sample link: ScheduleControl 
 
Regards, 
Mohanraj G 


Loader.
Live Chat Icon For mobile
Up arrow icon