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

Set 24h time format and change IntervalSpans

1 Answer 142 Views
TimeLine
This is a migrated thread and some comments may be shown as answers.
Sergey
Top achievements
Rank 1
Sergey asked on 21 Mar 2013, 10:51 AM
Hi, please tell me how to set 24h time format, and how to modify the IntervalSpans collection in the program code. As I understand it in the Q1 2013 release (version 2013.1.0220) this is possible.

1 Answer, 1 is accepted

Sort by
0
Missing User
answered on 26 Mar 2013, 09:17 AM
Hello Sergey,

You have to write your own format provider that implements IIntervalFormatterProvider (found in the Telerik.Windows.Controls.TimeBar namespace):
public class HourIntervalFormatter : IIntervalFormatterProvider
{
    public Func<DateTime, string>[] GetFormatters(IntervalBase interval)
    {
        return new Func<DateTime, string>[]
        {
            date => date.ToString("HH")
        };
    }
 
    public Func<DateTime, string>[] GetIntervalSpanFormatters(IntervalBase interval)
    {
        return new Func<DateTime, string>[]
        {
            date => date.ToString("HH")
        };
    }
}

Then, you have to set an instance of the above formatter to the FormatterProvider property of the HourInterval:
<telerik:RadTimeline.Intervals>
    <telerik:HourInterval FormatterProvider="{StaticResource HourIntervalFormatter}" />
</telerik:RadTimeline.Intervals>

Regards,
Ivan N.
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
TimeLine
Asked by
Sergey
Top achievements
Rank 1
Answers by
Missing User
Share this question
or