Calendar CurrentTimePointer - Only for current week

2 posts, 0 answers
  1. Robert
    Robert avatar
    4 posts
    Member since:
    Mar 2015

    Posted 21 Jun Link to this post



    I was wondering how I would go about modifying the radCalender control so that the currentTimePointer is drawn only on the current week rather than on every week in the calendar.


    I already have a customDayViewApppointmentsTable class that derives from the DayViewAppointmentsTable class that I've used to modify the size of the currentTimePointer, would the desired functionality be accessed through another override in this class?




  2. Hristo Merdjanov
    Hristo Merdjanov avatar
    671 posts

    Posted 21 Jun Link to this post

    Hello Robert,

    Thank you for writing.

    RadCalendar does not define a ruler so after looking at your other thread( I am assuming that you are using  a RadScheduler control.

    If that is indeed the case you can simply set the ShowCurrentTime property of the ruler to false when necessary. Please check my code snippet below handling the scenario you described: 
    public RadForm1()
        this.radScheduler1.ActiveView.PropertyChanged += ActiveView_PropertyChanged;
    private void ActiveView_PropertyChanged(object sender, PropertyChangedEventArgs e)
        if (e.PropertyName == "StartDate")
            RulerPrimitive ruler = (this.radScheduler1.SchedulerElement.ViewElement as SchedulerDayViewElement).DataAreaElement.Ruler;
            if (DateTime.Now >= this.radScheduler1.ActiveView.StartDate &&  DateTime.Now <= this.radScheduler1.ActiveView.EndDate)
                ruler.ShowCurrentTime = true;
                ruler.ShowCurrentTime = false;

    I hope this helps. Should you have further questions please do not hesitate to write back.

    Hristo Merdjanov
    Check out the Windows Forms project converter, which aids the conversion process from standard Windows Forms applications written in C# or VB to Telerik UI for WinForms. For more information check out this blog post and share your thoughts.
  3. DevCraft R3 2016 release webinar banner
Back to Top