Displaying selected appointment problem.

4 posts, 0 answers
  1. Phillip Foster
    Phillip Foster avatar
    58 posts
    Member since:
    Apr 2010

    Posted 07 May 2010 Link to this post

    Me Again!!
    I don't know if i'm doing something wrong, or if this is a bug. 
    I am trying to make my scheduler only show a given appointment.
    I wanted to display the hour before and after the appointment. To do so I am using this code:

    private void showAppointment(DateTime dt1) 
                rsAppointments.ActiveView.StartDate = Convert.ToDateTime(dt1.ToShortDateString()); 
                ((SchedulerDayView)rsAppointments.ActiveView).RulerStartScale = dt1.Hour - 1; 
                ((SchedulerDayView)rsAppointments.ActiveView).RulerEndScale = dt1.AddMinutes(Convert.ToDouble(appointDuration)).Hour + 1; 

    It works fine the first time its called, however after its been called a few times, it starts showing more and more time and will show the 3-6 hours before the appointment. 

    Any suggestions?

    Thanks!
  2. Dobry Zranchev
    Admin
    Dobry Zranchev avatar
    348 posts

    Posted 10 May 2010 Link to this post

    Hello Phillip Foster,

    Thank you for contacting us.

    In order to do this, we will suggest using another approach (although we will research why this is happening in your case).

    We will suggest scrolling to the time slot that you need by using the ScrollToTime method:
     
    SchedulerDayViewElement dayViewElement = (this.radScheduler1.SchedulerElement.ViewElement as SchedulerDayViewElement);
    TimeSpan time = new TimeSpan(1, 0, 0);
    dayViewElement.DataAreaElement.Table.ScrollToTime(time);
     
    You could take the SchedulerDayViewElement only from DayView, WeekView or WorkWeekView. As to changing the start date your code is correct.

    I hope this will help. If your have other questions feel free to ask.

    Regards,
    Dobry Zranchev
    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. UI for WinForms is Visual Studio 2017 Ready
  4. Phillip Foster
    Phillip Foster avatar
    58 posts
    Member since:
    Apr 2010

    Posted 10 May 2010 Link to this post

    hi, thank you for replying!

    However this doesn't seem to work for me. I maybe doing something wrong. 
    Here is my code. it does seem to go to that appointment, but the scroll doesn't seem to move to make it visible. 

                rsAppointments.ActiveView.StartDate = Convert.ToDateTime(dt1.ToShortDateString()); 
                             
                SchedulerDayViewElement dayViewElement = (this.rsAppointments.SchedulerElement.ViewElement as SchedulerDayViewElement); 
                TimeSpan time = new TimeSpan(dt1.Hour, 0, 0); 
                dayViewElement.DataAreaElement.Table.ScrollToTime(time); 
     
     
                this.rsAppointments.Appointments.BeginUpdate(); 
                nextAppoint = CreateAppointment(dt1, appointDuration, null, AppointmentType.NextAvail); 
                selectedAppoint = nextAppoint; 
                this.rsAppointments.Appointments.Add(nextAppoint); 
                this.rsAppointments.Appointments.EndUpdate(); 

  5. Dobry Zranchev
    Admin
    Dobry Zranchev avatar
    348 posts

    Posted 11 May 2010 Link to this post

    Hello Phillip Foster,

    The method ScrollToTime moves the scrollbar to the position where the start hour is visible. I think that you should use the following code snippet to achieve your scenario:
     
    DateTime dt1 = this.radScheduler1.ActiveView.StartDate.AddDays(5).AddHours(15);
    this.radScheduler1.ActiveView.StartDate = dt1.Date;
     
    SchedulerDayViewBase dayView = this.radScheduler1.ActiveView as SchedulerDayViewBase;
    dayView.RulerStartScale = dt1.Hour - 1;
    dayView.RulerEndScale = dt1.Hour + 2;
     
    SchedulerDayViewElement dayViewElement = (this.radScheduler1.SchedulerElement.ViewElement as SchedulerDayViewElement);
    TimeSpan time = new TimeSpan(dt1.Hour, 0, 0);
    dayViewElement.DataAreaElement.Table.ScrollToTime(time);
     
    After this code snippet you need to create your appointment. I hope this will help you.

    All the best,
    Dobry Zranchev
    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.
Back to Top