Skip to main content
All docs
V24.2

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

GanttControl.TimelineSplitterPositionChanging Event

Occurs before the timeline height is changed by a user and allows you to cancel the action.

Namespace: DevExpress.XtraGantt

Assembly: DevExpress.XtraGantt.v24.2.dll

NuGet Package: DevExpress.Win.Gantt

#Declaration

[DXCategory("Behavior")]
public event SplitterPositionChangingEventHandler TimelineSplitterPositionChanging

#Event Data

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

Property Description
Cancel Gets or sets a value indicating whether the event should be canceled. Inherited from CancelEventArgs.
NewValue Gets the position that is about to be set.
OldValue Gets the current position.

#Remarks

Users can change the height of the timeline if the AllowResize option is enabled.

Use the e.OldValue and e.NewValue event parameters to obtain the height of the timeline before and after the resize. Set the e.Cancel parameter to true to cancel the action.

Note

The Gantt control does not raise the TimelineSplitterPositionChanging and TimelineSplitterPositionChanged events when changing the value of the TimelineHeight property.

#Example

The following example demonstrates how to allow a user to resize the timeline within the specified range:

using System;
using DevExpress.XtraGantt;
using DevExpress.XtraGantt.TimeLine;

// Unlocks the timeline.
ganttControl1.OptionsTimeline.AllowResize = true;
ganttControl1.TimelineSplitterPositionChanging += GanttControl1_TimelineSplitterPositionChanging;

private void GanttControl1_TimelineSplitterPositionChanging(object sender, SplitterPositionChangingEventArgs e) {
    e.Cancel = (int)e.NewValue <= 150 || (int)e.NewValue >= 300;
}

Read the following topic for detailed information and examples: Timeline.

See Also