Back to Devexpress

AppointmentDisplayOptions.SnapToCellsMode Property

corelibraries-devexpress-dot-xtrascheduler-dot-appointmentdisplayoptions-9447eb39.md

latest8.9 KB
Original Source

AppointmentDisplayOptions.SnapToCellsMode Property

Gets or sets the method of snapping appointments to time cells.

Namespace : DevExpress.XtraScheduler

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

NuGet Package : DevExpress.Scheduler.CoreDesktop

Declaration

csharp
public virtual AppointmentSnapToCellsMode SnapToCellsMode { get; set; }
vb
Public Overridable Property SnapToCellsMode As AppointmentSnapToCellsMode

Property Value

TypeDescription
AppointmentSnapToCellsMode

A AppointmentSnapToCellsMode enumeration member, specifying the snap method.

|

Available values:

NameDescription
Auto

Appointment is stretched to cell border only if the distance from the cell border to the edge of an appointment is less than half of the cell width.

| | Always |

An appointment is always stretched to cell borders so that it occupies the entire cell or several cells.

| | Never |

The appointment visible width is proportional to its duration. There is a minimal visible width (about 5 pixels). If an appointment’s duration is quite small, it will never be narrower than the minimal width.

| | Disabled |

The appointment visible width is proportional to its duration. The minimal value of a dimension that represents the appointment duration is one pixel. The following picture illustrates the difference between the Disabled and Never modes for an appointment with a very small duration. The Disabled mode displays appointment as a line with a height of one pixel; however in Never mode, it looks like a small appointment with a height of several pixels, rather than a line.

|

Property Paths

You can access this nested property as listed below:

Object TypePath to SnapToCellsMode
SchedulerViewInfoBase

.AppointmentDisplayOptions .SnapToCellsMode

| | TimeCellsControlBase |

.AppointmentDisplayOptions .SnapToCellsMode

| | SchedulerViewBase |

.AppointmentDisplayOptions .SnapToCellsMode

|

Remarks

When snapping mode is set to Auto , an appointment is stretched to fill the cell(s) if its time interval does not include an entire cell. Different snap modes in the TimelineView are illustrated in the following pictures:

  • SnapToCellsMode = Always

  • SnapToCellsMode = Auto

  • SnapToCellsMode = Never

  • SnapToCellsMode = Disabled

To display appointments on the same line, you should set the SnapToCellsMode to Disabled. You may also need to adjust the timeline scale’s TimeScale.Width and set the AppointmentDisplayOptions.StartTimeVisibility and the AppointmentDisplayOptions.EndTimeVisibility to AppointmentTimeVisibility.Never.

For Day View and Work Week View views, the actual duration is indicated by colorizing the left border of the appointment if the AppointmentDisplayOptions.StatusDisplayType is set to AppointmentStatusDisplayType.Time. Snap modes for the DayView are illustrated below.

  • SnapToCellsMode = Always

  • SnapToCellsMode = Auto

  • SnapToCellsMode = Never

  • SnapToCellsMode = Disabled

The following code snippets (auto-collected from DevExpress Examples) contain references to the SnapToCellsMode 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-custom-draw-appointments/CS/CustomDrawDemo/Form1.cs#L35

csharp
schedulerControl1.Appearance.Appointment.ForeColor = Color.Gray;
schedulerControl1.TimelineView.AppointmentDisplayOptions.SnapToCellsMode = AppointmentSnapToCellsMode.Never;
schedulerControl1.TimelineView.AppointmentDisplayOptions.StatusDisplayType = AppointmentStatusDisplayType.Bounds;

winforms-scheduler-replace-default-command/CS/WindowsFormsApplication1/Form1.cs#L34

csharp
schedulerControl1.GroupType = DevExpress.XtraScheduler.SchedulerGroupType.Resource;
    schedulerControl1.TimelineView.AppointmentDisplayOptions.SnapToCellsMode = AppointmentSnapToCellsMode.Never;
}

winforms-scheduler-resolve-appointment-conflicts/CS/DXApplication1/Form1.cs#L60

csharp
schedulerControl1.Views.TimelineView.AppointmentDisplayOptions.SnapToCellsMode = AppointmentSnapToCellsMode.Always;
schedulerControl1.Views.MonthView.AppointmentDisplayOptions.SnapToCellsMode = AppointmentSnapToCellsMode.Always;

winforms-scheduler-custom-draw-appointments/VB/CustomDrawDemo/Form1.vb#L33

vb
schedulerControl1.Appearance.Appointment.ForeColor = Color.Gray
schedulerControl1.TimelineView.AppointmentDisplayOptions.SnapToCellsMode = AppointmentSnapToCellsMode.Never
schedulerControl1.TimelineView.AppointmentDisplayOptions.StatusDisplayType = AppointmentStatusDisplayType.Bounds

winforms-scheduler-replace-default-command/VB/WindowsFormsApplication1/Form1.vb#L34

vb
schedulerControl1.GroupType = DevExpress.XtraScheduler.SchedulerGroupType.Resource
    schedulerControl1.TimelineView.AppointmentDisplayOptions.SnapToCellsMode = AppointmentSnapToCellsMode.Never
End Sub

winforms-scheduler-resolve-appointment-conflicts/VB/DXApplication1/Form1.vb#L49

vb
schedulerControl1.DataStorage.Appointments.Add(apt2)
schedulerControl1.Views.TimelineView.AppointmentDisplayOptions.SnapToCellsMode = AppointmentSnapToCellsMode.Always
schedulerControl1.Views.MonthView.AppointmentDisplayOptions.SnapToCellsMode = AppointmentSnapToCellsMode.Always

See Also

AppointmentSnapToCellsMode

AppointmentDisplayOptions Class

AppointmentDisplayOptions Members

DevExpress.XtraScheduler Namespace