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

Calendar CurrentTimePointer - Only for current week

1 Answer 10 Views
Calendar, DateTimePicker, TimePicker and Clock
This is a migrated thread and some comments may be shown as answers.
Robert
Top achievements
Rank 1
Robert asked on 21 Jun 2016, 10:09 AM

Hi,

 

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?

 

Thanks,

Robert

1 Answer, 1 is accepted

Sort by
0
Hristo
Telerik team
answered on 21 Jun 2016, 12:50 PM
Hello Robert,

Thank you for writing.

RadCalendar does not define a so after looking at your other thread(http://www.telerik.com/forums/calendar-currenttimepointer) 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()
{
    InitializeComponent();
 
    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;
        }
        else
        {
            ruler.ShowCurrentTime = false;
        }
    }
}

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

Regards,
Hristo Merdjanov
Telerik
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.
Tags
Calendar, DateTimePicker, TimePicker and Clock
Asked by
Robert
Top achievements
Rank 1
Answers by
Hristo
Telerik team
Share this question
or