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

Timebar SelectionEnd off by a day.

1 Answer 58 Views
TimeBar
This is a migrated thread and some comments may be shown as answers.
Nate East
Top achievements
Rank 1
Nate East asked on 01 Dec 2015, 09:10 PM
My Timebar SelectionStart and SelectionEnd are bound to DateTime properties.  I also have 2 RadDatePickers bound to those date properties.  When I initially load the application, or change the date in the Finish DatePicker, the SelectionEnd date of the TimeBar is off by 1 day.  So if I pick 12/2/2015 in the DatePicker for my finish date, the timebar will display its' finish as 12/1/2015.  When you drag the SelectionEnd bar, or the entire bar, the dates sync back up, but you can cause the problem again by changing the date in the Finish DatePicker.

1 Answer, 1 is accepted

Sort by
0
Dinko | Tech Support Engineer
Telerik team
answered on 04 Dec 2015, 09:03 PM
Hello Nate,

The described behavior is caused by the nature of the selection feature of RadTimeBar. Basically, the selected interval doesn't include the end date, but it is defined just before it. This behavior reminds of excluding interval end points in mathematics. 

To achieve your requirement you can use several approaches:
  • Add +1 Tick to the DateTime object that defines the selection end.
  • Change the format string of the selection thumb's Title so that it displays the full date. In your case when you select (for example) 05.10.2012, the DateTime object will have its time set to 12:00:00A.M. and the interval coercion will change it to the 04.10.2012 11:59:59P.M. If you define another format string for the date you will see more accurate info. Here is an example in code:
    void timeBar_Loaded(object sender, RoutedEventArgs e)
    {
        var thumb = ChildrenOfTypeExtensions.FindChildByType<SelectionThumb>(this.timeBar);
        thumb.TitleFormatString = "{0:G} - {1:G}";
    }
  • Hide the Title of the selection thumb. Since, the selection range is displayed in the date pickers above the diagram, the additional info in the thumb is not required and you can remove it.

I hope that this information is helpful. 
 
Regards,
Dinko
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
TimeBar
Asked by
Nate East
Top achievements
Rank 1
Answers by
Dinko | Tech Support Engineer
Telerik team
Share this question
or