Skip to main content

AppointmentDisplayOptions.SnapToCellsMode Property

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

Namespace: DevExpress.XtraScheduler

Assembly: DevExpress.XtraScheduler.v24.1.Core.Desktop.dll

NuGet Package: DevExpress.Scheduler.CoreDesktop

Declaration

[XtraSerializableProperty]
public virtual AppointmentSnapToCellsMode SnapToCellsMode { get; set; }

Property Value

Type Description
AppointmentSnapToCellsMode

A AppointmentSnapToCellsMode enumeration member, specifying the snap method.

Available values:

Name Description
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.

SnapToCellMode-Auto

Always

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

SnapToCellMode-Always

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.

SnapToCellMode-Never

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.

SnapToCells_Disabled

Property Paths

You can access this nested property as listed below:

Object Type Path 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

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

    SnapToCellMode-Always

  • SnapToCellsMode = Auto

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

    SnapToCellMode-Auto

    Note

    In the Day-like views (Day, Full Week and Work Week views), the SnapToCellsMode property set to Auto may subsequently affect the appointment’s start and end time visibility, specified by the AppointmentDisplayOptions.StartTimeVisibility and the AppointmentDisplayOptions.EndTimeVisibility. With these properties set to Auto, the appointment start and end time will be displayed regardless of its alignment within the time cell.

  • SnapToCellsMode = Never

    SnapToCellMode-Never

  • SnapToCellsMode = 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 the appointment with a very small duration. The Never mode has a minimal width of several pixels to display an appointment, so an appointment will never appear as a line segment. The Disabled mode has a minimal width of one pixel, so you can distinguish between small appointments which have the same width in the Never mode, as illustrated in the following picture. In the Never mode, appointments with a very small duration are displayed as line segments.

    SnapToCellMode-Never-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

    SnapToCellDayViewAlways

  • SnapToCellsMode = Auto

    SnapToCellDayViewAuto

  • SnapToCellsMode = Never

    SnapToCellDayViewNever

  • SnapToCellsMode = Disabled

    SnapToCells_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.

See Also