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

Limit hour range - Day view

Hi! 

I'm using a schedule control only in Day ViewType and after searching in this forum i found nothing about limit the view to a range of hours.


For example, my program only works in hours between 8am and 4pm, I want to show only this range and not the whole day, this can be done?


Thanks in advance!

Bruno Santos

1 Reply

AA Arulraj A Syncfusion Team March 12, 2019 04:01 AM

Hi Bruno, 

Thanks for using Syncfusion product. 

You can achieve your required behavior by handling the QueryRowHeight and setting the height to zero for other rows except the needed ones. CellDrawn event need to be handled for the first row and draw the top border manually. Following code works for Day view. 

this.scheduleControl1.GetScheduleHost().QueryRowHeight += Form1_QueryRowHeight; 
this.scheduleControl1.GetScheduleHost().CellDrawn += Form1_CellDrawn; 
 
private void Form1_QueryRowHeight(object sender, Syncfusion.Windows.Forms.Grid.GridRowColSizeEventArgs e) 
{ 
    if (e.Index < 18 || e.Index > 35) 
    { 
        e.Size = 0; 
        e.Handled = true; 
    } 
} 
 
private void Form1_CellDrawn(object sender, Syncfusion.Windows.Forms.Grid.GridDrawCellEventArgs e) 
{ 
    if (e.RowIndex == 18) 
    { 
        e.Style.Borders.Top = e.Style.Borders.Bottom; 
    } 
} 

 

Regards, 
Arulraj A 


Loader.
Live Chat Icon For mobile
Up arrow icon