Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / Silverlight > Scheduler > RadScheduler scrolling to a specific time

Not answered RadScheduler scrolling to a specific time

Feed from this thread
  • Todd avatar

    Posted on Apr 29, 2010 (permalink)

    Is there a way to scroll the scheduler control so a certain time,or time span, of a specific date is visible?

    Thanks,

    Todd Nirenstein 

    Reply

  • Rosi Rosi admin's avatar

    Posted on Apr 30, 2010 (permalink)

    Hi Todd,

    I suggest you check this thread, illustrating how to achieve the desired behavior (though WPF related, the realization in Silverlight is the same).

    Greetings,
    Rosi
    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.

    Reply

  • Todd avatar

    Posted on May 1, 2010 (permalink)

    Hello Rosi,

    Thanks for the reply.  I read the post that you directed me to.  It did sound like the same issue.  I tried it by putting the code:

    var appointmentControl = this.scheduler.ChildrenOfType<AppointmentsControl>().Single(ac => ac.Name == "NotAllDayAppointmentsControl"); 
     
    var timeSlotItemHeight = appointmentControl.ChildrenOfType<TimeSlotItem>().First().ActualHeight; 
    var scrollVeiwer = appointmentControl.ParentOfType<ScrollViewer>(); 
     
    int timeSlotsToSkip = 5; 
    scrollVeiwer.ScrollToVerticalOffset(timeSlotsToSkip * timeSlotItemHeight); 

    into the contructor of my xaml page that contains the RadScheduler control, after the InitializeComponents call, and it errors out on the linq query in the first line saying, "Sequence contains no matching elements"  I'm not sure if it makes a difference or not but the Scheduler control has no Appointments in it. 

    Do you have any other suggestions or perhaps that makes sense to you?

    Thanks again,

    Todd

    Reply

  • Rosi Rosi admin's avatar

    Posted on May 3, 2010 (permalink)

    Hi Todd,

    This code should works as expected in Day and Week view. I suggest you set the ViewMode property to "Day" and let us known how this goes.

    Greetings,
    Rosi
    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.

    Reply

  • Todd avatar

    Posted on May 3, 2010 (permalink)

    Hi again Rosi,

    Still doesn't work.  This is what my constructor looks like:

     

     

    public MainPage()

     

    {

        InitializeComponent();

        ProjectScheduler.ViewMode =

     

    SchedulerViewMode.Day;

     

     

     


        var
    appointmentControl = ProjectScheduler.ChildrenOfType<AppointmentsControl>().Single(ac => ac.Name == "NotAllDayAppointmentsControl");

     

     

     

        var timeSlotItemHeight = appointmentControl.ChildrenOfType<TimeSlotItem>().First().ActualHeight;

     

     

     

        var scrollVeiwer = appointmentControl.ParentOfType<ScrollViewer>();

     

     

     

        int timeSlotsToSkip = 5;

     

        scrollVeiwer.ScrollToVerticalOffset(timeSlotsToSkip * timeSlotItemHeight);
    .
    .
    .
    .

    It dies in the first line (var appointmentControl = ....) with an InvalidOperationException that says "Sequence contains no matching element"

    Am I doing something wrong?

    Todd

    Reply

  • Rosi Rosi admin's avatar

    Posted on May 7, 2010 (permalink)

    Hi Todd,

    I suggest you set the ViewMode property in the XAML definition of RadScheduler instead of code-behind.
    Also, I suggest you change the code that throw the error like this:

    var appointmentControl = ProjectScheduler.ChildrenOfType<AppointmentsControl>().SingleOrDefault(ac => ac.Name == "NotAllDayAppointmentsControl");

    Regards,
    Rosi
    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.

    Reply

  • Daniel Billingsley Intermediate avatar

    Posted on May 7, 2010 (permalink)

    Does anybody have this actually working, or are we just talking theoretical code here?

    When I implement this and set a breakpoint after the ScrollToVerticalOffset, the VerticalOffset property of the scrollViewer is still zero.

    I find this in the MSDN documentation for ScrollViewer:
    "The VerticalOffset property will not be updated until a layout pass has occurred. You can force an update by calling UpdateLayout."

    I've tried adding an UpdateLayout call right after setting the scroll position, both on the scrollViewer and then I tried on the parent scheduler control, and still I get no scrolling.

    What's missing to make this actually work?

    Reply

  • Konstantina Konstantina admin's avatar

    Posted on May 13, 2010 (permalink)

    Hi Daniel,

    Thank you for contacting us.

    Attached I am sending you a sample project in which the desired behaviour is illustrated.
    Hope it helps.

    If you have further questions please do not hesitate to contact us again.

    Regards,
    Konstantina
    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.

    Reply

  • Daniel Billingsley Intermediate avatar

    Posted on May 14, 2010 (permalink)

    Yeah...um...

    I run that code and it does exactly what my code does... which is nothing.

    It works when I press the button, but doesn't automatically scroll when I switch to the week view.

    Does this code work on your system?

    Reply

  • Konstantina Konstantina admin's avatar

    Posted on May 17, 2010 (permalink)

    Hello Daniel,

    To make it work you can add a Dispatcher to the following line:

    Dispatcher.BeginInvoke(new Action(() =>
    {
         scrollViewer.ScrollToVerticalOffset(timeSlotsToSkip * timeSlotItemHeight);
    }));

    If you have further questions please let us know.

    All the best,
    Konstantina
    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.

    Reply

  • Posted on Aug 2, 2010 (permalink)

     

    I put the following codes in my constructor. However, it gives my error message right away saying AppointmentsControl doesn't contain 'Single' method and TimeSlotitem doesn't contain 'First' method. Do i need to include any assembly?

    var
    appointmentControl = this.scheduler.ChildrenOfType<AppointmentsControl> ().Single (ac => ac.Name == "NotAllDayAppointmentsControl");

     

     

    var timeSlotItemHeight = appointmentControl.ChildrenOfType<TimeSlotItem> ().First ().ActualHeight;

     

     

    ScrollViewer scrollVeiwer = appointmentControl.ParentOfType<ScrollViewer> ();

     

     

    int timeSlotsToSkip = 5;

     

    scrollVeiwer.ScrollToVerticalOffset (timeSlotsToSkip * timeSlotItemHeight);

    Reply

  • Rosi Rosi admin's avatar

    Posted on Aug 3, 2010 (permalink)

    Hi Yan Li,

    I suggest you check whether you have defined a using of the System.Linq namespace:

    using System.Linq;

    Greetings,
    Rosi
    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

    Reply

  • Thiyagu avatar

    Posted on Nov 8, 2011 (permalink)

    It doesnot work when appoinment is null

    Reply

  • Rosi Rosi admin's avatar

    Posted on Nov 8, 2011 (permalink)

    Hello Thiyagu,

    I suggest you review our RadScheduleView control and its ScrollIntoView method .

    Best wishes,
    Rosi
    the Telerik team

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

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / Silverlight > Scheduler > RadScheduler scrolling to a specific time
Related resources for "RadScheduler scrolling to a specific time"

Silverlight Scheduler Features  |  Documentation  |  Demos  |  Telerik TV  |  Self-Paced Trainer  ]