Events
You can handle the following events when using the RadTimeBar for a very rich user experience with the control:
GroupIntervalChanged: Fires when interval groups drill level changed.
HoveredPeriodChanged: Fires when the time period hovered changes.
ItemIntervalChanged: Fires when the interval items drill level changed.
VisiblePeriodChanged: Fires when the period that is currently visible has changed as we scroll and zoom within the control.
SelectionChanged: Fires when the time period selection has changed.
ActualSelectionChanged: Fires when the selected time period is changing, i.e., when the user is dragging one of the selection thumbs. The ActualSelectionStart and ActualSelectionEnd properties will hold the selected period at this point.
For example you can get the current item interval using the TimeBar.ItemIntervalChanged event via the TimeBar.CurrentItemInterval property. This event will also fire on initial load, when the best current item interval is set.
public MainPage()
{
InitializeComponent();
radTimeBar1.ItemIntervalChanged += new EventHandler<DrillEventArgs>(radTimeBar1_ItemIntervalChanged);
}
void radTimeBar1_ItemIntervalChanged(object sender, DrillEventArgs e)
{
if (radTimeBar1.CurrentItemInterval is MonthInterval)
{
radTimeBar1.SelectionStart = new DateTime(2012, 05, 1);
radTimeBar1.SelectionEnd = new DateTime(2012, 07, 1);
}
}
public MainPage()
Public Sub New()
InitializeComponent()
AddHandler radTimeBar1.ItemIntervalChanged, AddressOf radTimeBar1_ItemIntervalChanged
End Sub
Private Sub radTimeBar1_ItemIntervalChanged(ByVal sender As Object, ByVal e As DrillEventArgs)
If TypeOf radTimeBar1.CurrentItemInterval Is MonthInterval Then
radTimeBar1.SelectionStart = New Date(2012, 05, 1)
radTimeBar1.SelectionEnd = New Date(2012, 07, 1)
End If
End Sub
The same approach is applicable for groups - In order to get the current group interval you can use TimeBar.GroupIntervalChanged event and TimeBar.CurrentGroupInterval property respectively.