[Expand]General Information
[Collapse]WinForms Controls
  .NET Core Support
 [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]Property Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Gantt Control
  [Expand]Chart Control
  [Expand]Map Control
    Getting Started
   [Expand]Data Binding
   [Expand]Import and Export
   [Expand]Time Zones
   [Expand]Visual Elements
    [Expand]Data Binding
    [Expand]Data Exchange
    [Expand]Date and Time
    [Expand]Gantt View
    [Expand]Labels and Statuses
      How to: Programmatically Change the Active View
      How to: Group Appointments by Resources or Dates
      How to: Save and Restore a Layout
      How to: Merge Columns to Hide Specific Time Intervals in the Timeline View
    [Expand]Printing and Reporting
    [Expand]Range Control
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]PDF Viewer
  [Expand]TreeMap Control
  [Expand]Sunburst Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Report and Dashboard Server
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

How to: Merge Columns to Hide Specific Time Intervals in the Timeline View

This example illustrates how to hide columns for certain (non-working) hours in the Timeline View.

To accomplish this task, you can implement a custom time scale. It enables you to hide unneeded time periods.

A custom time scale class is inherited from the TimeScale class, overriding methods used for date and time handling and formatting.

The following properties and methods can be overridden to create a custom time scale:

  • SortingWeight - used to compare time scales;
  • TimeScale.Floor - specifies column boundaries;
  • HasNextDate - checks whether moving to the next date is allowed;
  • GetNextDate - navigates to the next date;
  • DefaultDisplayFormat - specifies the format for the column header caption;
  • DefaultMenuCaption - specifies the caption for the context menu item which enables this time scale;
  • TimeScale.FormatCaption - returns a string to be displayed as a column header caption.

To ensure proper alignment of an upper (Day) scale, create a descendant of the TimeScaleDay class that overrides the TimeScaleDay.Floor method. Add this descendant to the TimelineView.Scales collection in place of the default TimeScaleDay scale.

The resulting Timeline View is demonstrated in the following picture.


Actually, non-working hours are not hidden. They are packed within the last time cell of each day because the time line has to be continuous.

Is this topic helpful?​​​​​​​