Skip to main content
A newer version of this page is available. .

How to: Access the List Editor's Control

  • 2 minutes to read

This article describes how to access any List Editor‘s control. Use this approach in WinForms and ASP.NET applications to change how the control is displayed.

Note

Blazor applications do not support the Scheduler Module.

The example below demonstrates how to set an 8AM-5PM time interval for the WinForms Scheduler Module‘s SchedulerControl.

SchedulerControl_Access

Tip

A complete sample project is available in the DevExpress Code Examples database at https://supportcenter.devexpress.com/ticket/details/e225/how-to-access-the-scheduler-control.

Access and modify the SchedulerControl by following the steps below:

  1. Add the Scheduler Module to your WinForms module project.
  2. Add the Event business class to the platform-agnostic module project, as shown in the Add a Class from the Business Class Library and Use the Scheduler Module (XPO/EF) topic.
  3. Create a new ObjectViewController<ViewType, ObjectType> descendant called “WinSchedulerController”. Set the Controller’s ViewType parameter to ListView, and the ObjectType parameter to IEvent - the interface the Event business class implements.
  4. Override the OnViewControlsCreated method to access the SchedulerControl directly after the control’s creation.
  5. Set the SchedulerControl‘s DayView.VisibleTime property to a new interval, 8AM-5PM.

The following code demonstrates the WinSchedulerController:

using DevExpress.XtraScheduler;
using DevExpress.ExpressApp;
using DevExpress.ExpressApp.Scheduler.Win;
using DevExpress.Persistent.Base.General;
// ...
public class WinSchedulerController : ObjectViewController<ListView, IEvent> {
    protected override void OnViewControlsCreated() {
        base.OnViewControlsCreated();
        SchedulerListEditor listEditor = View.Editor as SchedulerListEditor;
        if (listEditor != null) {
            SchedulerControl scheduler = listEditor.SchedulerControl;
            scheduler.Views.DayView.VisibleTime =
                new TimeOfDayInterval(new TimeSpan(8, 0, 0), new TimeSpan(17, 0, 0));
        }
    }
}

Run the WinForms application and make sure that the visible time interval is between 8 AM and 5 PM (see the image above).

Similarly, you can access the ASPxSchedulerListEditor and its ASPxScheduler control in ASP.NET applications.