This is a migrated thread and some comments may be shown as answers.

Time Bar Click Event on Selection Period

1 Answer 50 Views
TimeBar
This is a migrated thread and some comments may be shown as answers.
Balaji
Top achievements
Rank 1
Balaji asked on 02 Aug 2011, 04:18 AM
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

1 Answer, 1 is accepted

Sort by
0
Yavor
Telerik team
answered on 04 Aug 2011, 02:00 PM
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 >>

Tags
TimeBar
Asked by
Balaji
Top achievements
Rank 1
Answers by
Yavor
Telerik team
Share this question
or