Weeknumber TimerulerMajorTick

6 posts, 0 answers
  1. Benny
    Benny avatar
    8 posts
    Member since:
    Sep 2012

    Posted 04 Apr 2011 Link to this post

    Is there any way to get the SchedelureView to show the weeknumber in TimeRulerMajorTick.

    FixedTickLengthProvider sevenDays = new FixedTickLengthProvider();
               sevenDays.TickLength = new TimeSpan(7, 0, 0, 0, 0); 
               SchProjekt.ViewDefinitions.Add(new TimelineViewDefinition()
                   MajorTickLength = sevenDays,
                   Orientation = Orientation.Horizontal,
                   StretchGroupHeaders = true,
                   VisibleDays = 365,
                   Title = "Projekt",
                   TimerulerGroupStringFormat = "{0:MMM - yyyy}",
                   TimerulerMajorTickStringFormat = "{0:ddd}",
                   MinTimeRulerExtent = 1600,
                   MaxTimeRulerExtent = 1600

    This shows the day of week, but i need to show the week number... 

    public static int GetWeekNumber(this DateTime date)
              CultureInfo ci = CultureInfo.CurrentCulture;
              int wNr = ci.Calendar.GetWeekOfYear(date, CalendarWeekRule.FirstFourDayWeek, DayOfWeek.Monday);
              return wNr;
  2. Konstantina
    Konstantina avatar
    2332 posts

    Posted 07 Apr 2011 Link to this post

    Hi Benny,

    Thank you for contacting us.

    Unfortunately, showing the week number into the TimeRuler is not possible, as this String format is not supported by the .NET platform. Please refer to this article for more information about the supported formats.

    Hope this information helps. Please let us know if you have further questions.

    the Telerik team
    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 Public Issue Tracking system and vote to affect the priority of the items
  3. Stefan
    Stefan avatar
    1 posts
    Member since:
    Jun 2011

    Posted 03 Jan 2012 Link to this post


    we need this feature, too. Are there any plans to support this in the future. I understand that the group header formating concept is based on the .NET formating mechanism, but showing the week numbers in the calendar is quite a common request.

    Best regards,
  4. Yana
    Yana avatar
    4604 posts

    Posted 06 Jan 2012 Link to this post

    Hello Stefan,

    Please find attached a simple example which demonstrates how you can show week numbers in the TimeRuler. Download the project and give it a try.

    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  5. Ivo
    Ivo avatar
    48 posts
    Member since:
    Jul 2011

    Posted 09 Jan 2012 Link to this post

    Hi Yana,

    thanks for the sample project. This is almost what I needed. From what I can see in this code is that it works only if the first day which is shown in the ScheduleView must be Monday, but what if the user decided to selects different day (Sunday, Friday,...)?
    In this case ScheduleView would group the days incorrectly (not from monday - Sunday). Is there any chance to display week correctly in this scenario?

    Best regards, Stefan
  6. Ivo
    Ivo avatar
    48 posts
    Member since:
    Jul 2011

    Posted 10 Jan 2012 Link to this post

    Hi Yana,

    I found the answer to my question here:

    I wrote my own TickPrivider in order to format the grouping header correctly. Thanks a lot!

    Best regards, Stefan
Back to Top