Formatting Services
- 3 minutes to read
Different parts of the application may require different formatting, especially for time and dates. A set of services is implemented to facilitate this task regarding the XtraScheduler Suite.
These services are:
TimeRulerFormatStringService
ITimeRulerFormatStringService interface provides the means to custom format the text of time labels within the Time Ruler. You can override the following methods, substituting the service with its custom descendant:
- GetHourFormat(TimeRuler ruler)
- GetHalfDayHourFormat(TimeRuler ruler)
- GetHourOnlyFormat(TimeRuler ruler)
- GetTimeDesignatorOnlyFormat(TimeRuler ruler)
- GetMinutesOnlyFormat(TimeRuler ruler)
These methods should return a format string specifying how to display a corresponding visual element. The location of elements within the time ruler is illustrated below.
TimeSlot.Value is 60 minutes:
TimeSlot.Value is 6 minutes:
For the code sample, which uses the time ruler formatting service, refer to the How to: Display TimeRulers with Different Time Formats Together document.
HeaderCaptionService
IHeaderCaptionService interface enables you to change the captions of the headers in different views. You can override the corresponding method, substituting the service with its custom descendant. It should return a format string specifying how to display a header in the corresponding view. For the code sample, refer to the How to: Display Custom Day Headers article and the online example Formatting Services - an example of use.
HeaderToolTipService
IHeaderToolTipService interface allows you to specify custom tooltips for the day headers. You can override the following methods, substituting the service with its custom descendant:
- HeaderToolTipService.GetDayColumnHeaderToolTip
- HeaderToolTipService.GetDayOfWeekHeaderToolTip
- HeaderToolTipService.GetTimeScaleHeaderToolTip
Overridden methods should return a format string specifying how to display a header’s tooltip in the corresponding view. The method for using this service is the same as described for the HeaderCaptionService.
AppointmentFormatStringService
AppointmentFormatStringService class enables you to customize the time display format used in the visual representation of appointments. You can override the following methods, substituting the service with its custom descendant:
- AppointmentFormatStringService.GetHorizontalAppointmentStartFormat
- AppointmentFormatStringService.GetHorizontalAppointmentEndFormat
- AppointmentFormatStringService.GetVerticalAppointmentStartFormat - applicable to the Timeline View
- AppointmentFormatStringService.GetVerticalAppointmentEndFormat - applicable to the Timeline View
- AppointmentFormatStringService.GetContinueItemStartFormat - applicable if AppointmentDisplayOptions.ContinueArrowDisplayType is AppointmentContinueArrowDisplayType.ArrowWithText;
- AppointmentFormatStringService.GetContinueItemEndFormat - applicable if AppointmentDisplayOptions.ContinueArrowDisplayType is AppointmentContinueArrowDisplayType.ArrowWithText;
Overridden methods should return a format string specifying how to display a day header’s tooltip in the corresponding view. The method for using this service is the same as described for the services above. Review the How to: Display Appointments in Military Time for the code sample.
Review the Introduction to Services in XtraScheduler document, for information on implementing services in your application.