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

TimeBar - Slider move to clicked position

1 Answer 160 Views
TimeBar
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 07 Jan 2019, 06:37 AM

I have RadTimeline in RadTimeBar

The timeline has some items

I want that click between the timeline's items will change the TimeBar's slider location (value)

according the position that I clicked

(I don't mind that each click (also on timeline's items) will do the same (move the slider to clicked position)

and I will change that double click makes the selection item on the timeline)

            <telerik:RadTimeBar x:Name="radTimeBar"
                            PeriodStart="{Binding StartDate}" 
                            PeriodEnd="{Binding EndDate}" MouseDoubleClick="radTimeBar_MouseDoubleClick"
                            VisiblePeriodStart="{Binding VisibleStartDate}" 
                            VisiblePeriodEnd="{Binding VisibleEndDate}"                            
                            SelectionStart="{Binding CurrentTime, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" 
                            SelectionChanged="radTimeBar_SelectionChanged"                            
                            ScrollMode="ScrollAndZoom">

                <telerik:RadTimeline x:Name="radTimeline" 
                                     PeriodStart="{Binding StartDate}" 
                                     PeriodEnd="{Binding EndDate}" 
                                     VisiblePeriodStart="{Binding StartDate}" 
                                     VisiblePeriodEnd="{Binding EndDate}"    
                                     SelectionChanged="RadTimeline_SelectionChanged"
                                     IsSelectionEnabled="True" 
                                     StartPath="StartDate" DurationPath="Duration" ItemsSource="{Binding Events}"                                      
                                     ScrollMode="None">
                </telerik:RadTimeline>
                <telerik:RadTimeBar.Intervals>
                    <telerik:MinuteInterval />
                </telerik:RadTimeBar.Intervals>
            </telerik:RadTimeBar>

Thanks

1 Answer, 1 is accepted

Sort by
0
Martin Ivanov
Telerik team
answered on 09 Jan 2019, 05:59 AM
Hello David,

To change the visible selection (the slider position) of the RadTimeBar manually you can use its VisiblePeriodStart and VisiblePeriodEnd properties. You can get the date under the mouse using the ConvertPointToDateTime method of the RadTimeBar control.

As for the double click selection in the timeline, there is no such behavior out of the box. However, you can achieve it by disabling the default selection by setting the IsSelectionEnabled property of RadTimeline to False. And then subscribe to the MouseDoubleClick event of the timeline. In the event handler you can get the TimelineItemControl under the mouse and set its IsSelected property manually. You can all visible TimelineItemControl objects using the visual tree helper methods and then find the one under the mouse by checking the IsMouseOver property of each item control.
 
I hope that helps.

Regards,
Martin Ivanov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
TimeBar
Asked by
David
Top achievements
Rank 1
Answers by
Martin Ivanov
Telerik team
Share this question
or