Skip to main content

SchedulerControl.LimitInterval Property

Gets or sets the time interval available for end-users.

Namespace: DevExpress.XtraScheduler

Assembly: DevExpress.XtraScheduler.v24.2.dll

Declaration

[XtraSerializableProperty(XtraSerializationVisibility.Content, XtraSerializationFlags.DefaultValue)]
public TimeInterval LimitInterval { get; set; }

Property Value

Type Description
TimeInterval

A TimeInterval object.

Remarks

This method is intended to restrict the user from operation beyond the specified time interval and block the display of appointments scheduled for dates outside this interval. When specifying the interval, you should not exceed the real-life time range which is common for the DateTime value type: from 12:00:00 midnight, January 1, 0001 Anno Domini (Common Era) to 11:59:59 P.M., December 31, 9999 A.D. (C.E.)

The Date Navigator control bound to a SchedulerControl displays only dates within the LimitInterval and hides dates outside it.

Note that the actual visible interval is dependent on the selected view. A view has a certain detail level which cannot be partially displayed. For example, the Week View can only show the entire week, so if some days of the week fall outside the LimitInterval, they will still be displayed.

When specifying the LimitInterval for the Timeline View, you may find out that additional columns are displayed beyond the specified limits, or the last column has virtually disappeared. To understand this behavior, consider that the time scale used in the Timeline view is continuous and uniform, i.e., all columns have the same width. So if the visible area of the view contains more cells than it is required to represent the LimitInterval, additional columns are shown. If the width of the visible area, in pixels, is not an integer multiple of the column width for the current scale, the last column is shown several pixels wide just to indicate its presence. When you resize a Timeline view, you will see that when the View area width is not an integer multiple of the scale width, and the last column visually collapses.

You can calculate the required width and manually adjust the window size to display all columns correctly. The following code snippet illustrates the technique.

int baseCellWidth = schedulerControl1.TimelineView.GetBaseTimeScale().Width;
bool allowUpdating = true;

Form1.ResizeEnd += new System.EventHandler(Form1.Form1_ResizeEnd);

private void Form1_ResizeEnd(object sender, EventArgs e)
{
    if (allowUpdating)
    {
        allowUpdating = false;
        int cellsCount = schedulerControl1.TimelineView.ViewInfo.Timelines[0].Cells.Count;
        int totalCellsWidth = cellsCount * baseCellWidth;
        this.ClientSize = new Size(totalCellsWidth, this.ClientSize.Height);
        allowUpdating = true;
    }
}
See Also