Skip to main content
A newer version of this page is available. .

GanttView.RequestTimescaleRulers Event

Occurs when timescale rulers are visually changed and allows you to edit timescale rulers. This is a routed event.

Namespace: DevExpress.Xpf.Gantt

Assembly: DevExpress.Xpf.Gantt.v21.2.dll

NuGet Package: DevExpress.Wpf.Gantt

Declaration

public event EventHandler<RequestTimescaleRulersEventArgs> RequestTimescaleRulers

Event Data

The RequestTimescaleRulers event's data class is RequestTimescaleRulersEventArgs. The following properties provide information specific to this event:

Property Description
Handled Gets or sets a value that indicates the present state of the event handling for a routed event as it travels the route. Inherited from RoutedEventArgs.
NonworkingDayVisibility Gets or sets the nonworking day visibility at a current zoom level.
NonworkingTimeVisibility Gets or sets the nonworking time visibility at a current zoom level.
OriginalSource Gets the original reporting source as determined by pure hit testing, before any possible Source adjustment by a parent class. Inherited from RoutedEventArgs.
RoutedEvent Gets or sets the RoutedEvent associated with this RoutedEventArgs instance. Inherited from RoutedEventArgs.
Source Gets or sets a reference to the object that raised the event. Inherited from RoutedEventArgs.
TimescaleRulers Get or sets a collection of timescale rulers displayed at the current zoom level.
Zoom Gets the current zoom.

The event data class exposes the following methods:

Method Description
InvokeEventHandler(Delegate, Object) When overridden in a derived class, provides a way to invoke event handlers in a type-specific way, which can increase efficiency over the base implementation. Inherited from RoutedEventArgs.
OnSetSource(Object) When overridden in a derived class, provides a notification callback entry point whenever the value of the Source property of an instance changes. Inherited from RoutedEventArgs.

Remarks

The RequestTimescaleRulers event occurs on init, when the Gantt area is zoomed and when the TimescaleRulerCount property value is changed.

Handle the RequestTimescaleRulers event to dynamically change the following:

private void view_RequestTimescaleRulers(object sender, DevExpress.Xpf.Gantt.RequestTimescaleRulersEventArgs e) {
    // Remove a ruler from timescale
    e.TimescaleRulers.RemoveAt(2);
    // Add a ruler that indicates hours
    e.TimescaleRulers.Add(new DevExpress.Xpf.Gantt.TimescaleRuler(DevExpress.Xpf.Gantt.TimescaleUnit.Hour));
    // Add a ruler that indicates 30 minute ranges
    e.TimescaleRulers.Add(new DevExpress.Xpf.Gantt.TimescaleRuler(DevExpress.Xpf.Gantt.TimescaleUnit.Minute, 30));

    // Nonworking dates and nonworking time are not indicated with a specific background
    e.NonworkingDayVisibility = Visibility.Hidden;
    e.NonworkingTimeVisibility = Visibility.Hidden;
}

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the RequestTimescaleRulers event.

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