Back to Devexpress

Appointment.Duration Property

corelibraries-devexpress-dot-xtrascheduler-dot-appointment-e862e115.md

latest4.8 KB
Original Source

Appointment.Duration Property

Gets or sets the duration of the appointment.

Namespace : DevExpress.XtraScheduler

Assembly : DevExpress.XtraScheduler.v25.2.Core.dll

NuGet Package : DevExpress.Scheduler.Core

Declaration

csharp
TimeSpan Duration { get; set; }
vb
Property Duration As TimeSpan

Property Value

TypeDescription
TimeSpan

A TimeSpan value representing the duration of the appointment.

|

Remarks

The Duration property and the Appointment.Start property specify the value of the Appointment.End property for the appointment. This value is always calculated as End = Start + Duration.

Note

The Ticks property value of the Duration should be greater than or equal to 0.

The following code snippets (auto-collected from DevExpress Examples) contain references to the Duration property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

winforms-scheduler-create-appointments-on-reminder-alert/CS/ReminderCustomActions/Form1.cs#L52

csharp
app.Start = e.AlertNotifications[0].ActualAppointment.Start.AddHours(2);
app.Duration = TimeSpan.FromHours(4);
schedulerDataStorage1.Appointments.Add(app);

winforms-scheduler-drag-drop-appointments-from-grid/CS/T179722/Form1.cs#L90

csharp
Start = DateTime.MinValue,
Duration = apt.Duration,
LabelKey = (int)apt.LabelKey,

asp-net-web-forms-scheduler-copy-paste-appointment-context-menu-items/CS/WebApplication1/Default.aspx.cs#L108

csharp
newAppointment.Start = ASPxScheduler1.SelectedInterval.Start;
newAppointment.End = newAppointment.Start + sourceAppointment.Duration;

winforms-scheduler-create-appointments-on-reminder-alert/VB/ReminderCustomActions/Form1.vb#L54

vb
app.Start = e.AlertNotifications(0).ActualAppointment.Start.AddHours(2)
app.Duration = TimeSpan.FromHours(4)
schedulerDataStorage1.Appointments.Add(app)

winforms-scheduler-drag-drop-appointments-from-grid/VB/T179722/Form1.vb#L77

vb
Dim apt = aptInfo.EditedAppointment
    exchangeList.Add(New T179722.AppointmentExchangeData() With {.Subject = apt.Subject, .Description = apt.Description, .Start = System.DateTime.MinValue, .Duration = apt.Duration, .LabelKey = CInt(apt.LabelKey), .StatusKey = CInt(apt.StatusKey)})
Next

asp-net-web-forms-scheduler-copy-paste-appointment-context-menu-items/VB/WebApplication1/Default.aspx.vb#L110

vb
newAppointment.Start = ASPxScheduler1.SelectedInterval.Start
newAppointment.End = newAppointment.Start + sourceAppointment.Duration
ASPxScheduler1.Storage.Appointments.Add(newAppointment)

See Also

Appointment Interface

Appointment Members

DevExpress.XtraScheduler Namespace