Edit this page

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 selected has changed.

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.

C#

          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);
            }
        }

VB.NET

   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.