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.
Unfortunately, activation email could not send to your email. Please try again.

Limit number of hours shown in workweek view

Thread ID:

Created:

Updated:

Platform:

Replies:

105953 Nov 29,2012 05:34 PM Aug 30,2017 09:39 AM Windows Forms 3
loading
Tags: ScheduleControl
Eric Robishaw
Asked On November 29, 2012 05:34 PM

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

Vinish Kumar K [Syncfusion]
Replied On December 5, 2012 05:50 AM

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.


Raul
Replied On August 29, 2017 11:00 AM

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


Mohanraj Gunasekaran [Syncfusion]
Replied On August 30, 2017 09:39 AM

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 


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.

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.

;