Time Bar Click Event on Selection Period

2 posts, 0 answers
  1. Balaji
    Balaji avatar
    19 posts
    Member since:
    Jul 2011

    Posted 01 Aug 2011 Link to this post

    Hi,

    How to registered the click event on "Selection Period" in Timebar control?
    I was able to Drag and Drop or Extended the Selection Period ? is it possible to capture those events in the server side if so how to do?

    Also it is possible to register the click event on the "Selection Bar"  section or control ? is so how to do that.



    Thanks & Regards
    B.Balaji
  2. Yavor
    Admin
    Yavor avatar
    401 posts

    Posted 04 Aug 2011 Link to this post

    Hi Balaji,

    RadTimeBar has different events that notify about different changes in the period. You can see a list of events and a short description in our online help system here.

    Currently if you wish to listen for events on the SelectionThumb currently you have to find it from the visual tree. This can be done on a event that is fired after the complete visual tree for the RadTimeBar is created, for example GotFocus event. Here is some sample code:

    <telerik:RadTimeBar Name="timebar1" VerticalAlignment="Top" Height="150" GotFocus="timebar1_GotFocus"
                        PeriodStart="2011/07/01" PeriodEnd="2011/08/01">
        <telerik:RadTimeBar.Intervals>
            <telerik:DayInterval />
            <telerik:WeekInterval />
        </telerik:RadTimeBar.Intervals>
    </telerik:RadTimeBar>

    private void timebar1_GotFocus(object sender, RoutedEventArgs e)
    {
        // Detach event handler
        RadTimeBar timeBar = sender as RadTimeBar;
        timeBar.GotFocus -= timebar1_GotFocus;
     
        // Find SelectionThumb from the visual tree
        var selectionThumb = timebar1.ChildrenOfType<SelectionThumb>().Single();
        selectionThumb.MouseLeftButtonUp += selectionThumb_MouseLeftButtonUp;
    }
     
    void selectionThumb_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
    {
        MessageBox.Show("SelectionThumb click!");
    }

    I have attached a sample project that demonstrates the sample code above in action.
    Hope this information helps!

     Kind regards,
    Yavor Ivanov
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

  3. DevCraft banner
Back to Top