Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Collapse]WinForms Controls
  Prerequisites
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications and Dialogs
  [Expand]Editors and Simple Controls
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Expand]Data Grid
  [Expand]Vertical Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Chart Control
  [Expand]Diagrams
  [Expand]Gauges
  [Expand]Map Control
  [Collapse]Scheduler
   [Expand]Product Information
   [Expand]Getting Started
   [Expand]Fundamentals
   [Expand]Visual Elements
   [Expand]Design-Time Features
   [Collapse]Examples
    [Expand]Appearance
    [Expand]Data Binding
    [Expand]Data Exchange
    [Collapse]DateTime
      How to: Implement Custom Conversion of a TimeSpan Value
      How to: Set Custom Working Days
      How to: Add Custom Holidays
      How to: Load Holidays from the Outlook.hol file
      How to: Load Holidays from an XML file
      How to: Show Night Shift as One Day in the DayView
      How to: Display TimeRulers with Different Time Formats Together
      How to: Display Appointments in Military Time
      How to: Modify Date Formatting of Headers in the XtraScheduler Report
    [Expand]DateNavigator
    [Expand]Forms
    [Expand]Gantt View
    [Expand]Initialization
    [Expand]Labels and Statuses
    [Expand]Layout
    [Expand]Menu
    [Expand]Printing and Reporting
    [Expand]Protection
    [Expand]Range Control
    [Expand]Recurrence
    [Expand]Reminders
    [Expand]Selection
   [Expand]End-User Capabilities
   [Expand]Member Tables
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]Printing-Exporting
  [Expand]PDF Viewer
   Reporting
  [Expand]Snap
  [Expand]TreeMap Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

How to: Display TimeRulers with Different Time Formats Together

This document illustrates the use of TimeRulerFormatStringService to change the display format of a time ruler. What are the advantages of this approach? Well, to modify the display time format you could change the culture settings for the whole application, as shown below:

But, if you need different time formats in different parts of a control, then you should definitely look at the Formatting Services.They provide the capability to implement a scenario when the time ruler with local time will display AM/PM, while another uses 24 hr time.

To accomplish this, substitute the service with a custom service, containing methods overridden as required.

The result is shown below:

Our task consists of three parts: Create a descendant class, Create a service, Substitute a service.

Expanded Create a Descendant Class

Expanded Create a Service

Expanded Substitute the Service

Show Me

A complete sample project is available in the DevExpress Code Examples database at http://www.devexpress.com/example=E507.

Expanded See Also

How would you rate this topic?​​​​​​​