AppointmentDisplayOptions.SnapToCellsMode Property
Gets or sets the method of snapping appointments to time cells.
Namespace: DevExpress.XtraScheduler
Assembly: DevExpress.XtraScheduler.v24.2.Core.Desktop.dll
Declaration
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. |
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 Type | Path to SnapToCellsMode |
---|---|
SchedulerViewInfoBase |
|
TimeCellsControlBase |
|
SchedulerViewBase |
|
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.
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.
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
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.
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
Related GitHub Examples
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.