windowsforms-devexpress-dot-xtragantt-dot-ganttcontrol-7e333ff3.md
Occurs before the timeline height is changed by a user and allows you to cancel the action.
Namespace : DevExpress.XtraGantt
Assembly : DevExpress.XtraGantt.v25.2.dll
NuGet Package : DevExpress.Win.Gantt
[DXCategory("Behavior")]
public event SplitterPositionChangingEventHandler TimelineSplitterPositionChanging
<DXCategory("Behavior")>
Public Event TimelineSplitterPositionChanging As SplitterPositionChangingEventHandler
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. |
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.
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;
}
Imports System
Imports DevExpress.XtraGantt
Imports DevExpress.XtraGantt.TimeLine
' Unlocks the timeline.
Private Sub GanttControl1_TimelineSplitterPositionChanging(ByVal sender As Object, ByVal e As SplitterPositionChangingEventArgs)
e.Cancel = CInt(Math.Truncate(e.NewValue)) <= 150 OrElse CInt(Math.Truncate(e.NewValue)) >= 300
End Sub
Read the following topic for detailed information and examples: Timeline.
See Also