Skip to main content
All docs
V24.2

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

DxScheduler.ScrollTo(DateTime) Method

Scrolls the scheduler’s view to the specified date and time.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.2.dll

NuGet Package: DevExpress.Blazor

#Declaration

C#
public void ScrollTo(
    DateTime date
)

#Parameters

Name Type Description
date DateTime

The target date and time.

#Remarks

Use the ScrollTo method to scroll to the specified time point. The method tries to place the specified time cell to the top left corner of the view. If several time cells meet the specified criteria, the scheduler scrolls to the first found time cell.

Note that if the specified time point is not present in the displayed view, the method does nothing.

The following code snippet scrolls to May 9, 2024, 9:00 AM (beginning of the work day) on the first render:

Razor
<style>
    .my-scheduler { 
        height: 600px; 
    } 
</style>

<DxScheduler @bind-StartDate="@StartDate"
             DataStorage="@DataStorage"
             @ref="Scheduler"
             CssClass="my-scheduler">
    <DxSchedulerWorkWeekView ShowWorkTimeOnly="ShowWorkTimeOnly"></DxSchedulerWorkWeekView>
</DxScheduler>

@code {
    DateTime StartDate { get; set; } = new DateTime(2024, 05, 09);
    bool ShowWorkTimeOnly { get; set; } = false;
    DxScheduler Scheduler { get; set; }

    protected override void OnAfterRender(bool firstRender) {
        base.OnAfterRender(firstRender);
        if(firstRender) {
            Scheduler.ScrollTo(new DateTime(2024, 05, 09, 09, 00, 00));
        }
    }

    DxSchedulerDataStorage DataStorage = new DxSchedulerDataStorage() {
        AppointmentsSource = AppointmentCollection.GetAppointments(),
        AppointmentMappings = new DxSchedulerAppointmentMappings() {
            Type = "AppointmentType",
            Start = "StartDate",
            End = "EndDate",
            Subject = "Caption",
            AllDay = "AllDay",
            Location = "Location",
            Description = "Description",
            LabelId = "Label",
            StatusId = "Status",
            RecurrenceInfo = "Recurrence"
        }
    };
}
See Also