Set 24h time format and change IntervalSpans

2 posts, 0 answers
  1. Sergey
    Sergey avatar
    1 posts
    Member since:
    Dec 2012

    Posted 21 Mar 2013 Link to this post

    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.
  2. Missing user
    Missing user avatar

    Posted 26 Mar 2013 Link to this post

    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.

  3. UI for WPF is Visual Studio 2017 Ready
Back to Top