Scroll appointment into view

12 posts, 2 answers
  1. Oscar Wahlen
    Oscar Wahlen avatar
    33 posts
    Member since:
    Mar 2010

    Posted 02 May 2011 Link to this post

    How can I scroll appointments into view? I tried ScheduleView.ScrollTimeRuler as suggested, but I could not find the method. Was this method removed? I am using the latest internal build (2011.1.0427).
  2. Answer
    Konstantina
    Admin
    Konstantina avatar
    2332 posts

    Posted 03 May 2011 Link to this post

    Hi Oscar,

    The method is not visible in the IntelliSense because it might be changed in the future. However, you can still use it. It takes two parameters: ScrollTimeRuler(TimeSpan, bool) - The first parameter specifies the time which should be scrolled to, the second specifies whether to scroll that time to the top/left, or not.

    Hope this information helps.

    Greetings,
    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
  3. DevCraft banner
  4. Steve
    Steve avatar
    6 posts
    Member since:
    Apr 2011

    Posted 03 May 2011 Link to this post

    I have had no success with either ScrollTimeRuler or ScrollIntoView.  Can you post a sample project that illustrates their use?  I'm particularly interested in ScrollIntoView.
  5. Answer
    Konstantina
    Admin
    Konstantina avatar
    2332 posts

    Posted 05 May 2011 Link to this post

    Hi Oscar,

    You can check out the ScrollIntoView() method very easy in Reflector. There you will find all the necessary information for all the overloads. Please find the screenshot for reference.

    Hope this will help. Let is know if you still experience difficulties by providing more information about your scenario.

    Greetings,
    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
  6. Steve
    Steve avatar
    6 posts
    Member since:
    Apr 2011

    Posted 05 May 2011 Link to this post

    Still having trouble with ScrollIntoView.  Here's a code snippet.  Is anything obviously wrong?

                Dim apt As Appointment = DirectCast(viewModel.MyApptCollection(0), Appointment)
                ' Neither of these works...
                RadScheduleView1.ScrollIntoView(apt)
                RadScheduleView1.Dispatcher.BeginInvoke( _
                    Sub() RadScheduleView1.ScrollIntoView(apt) _
                    )
    
  7. Oscar Wahlen
    Oscar Wahlen avatar
    33 posts
    Member since:
    Mar 2010

    Posted 09 May 2011 Link to this post

    Hi Steve,

    This is how I use the ScheduleView.ScrollIntoView method.

    Scroll with date grouping and align to left (no resource grouping):
    this.MyScheduleView.ScrollIntoView(myApp, true);


    Scroll with date and resource grouping and align to left:
    this.MyScheduleView.ScrollIntoView(myApp.Start, true, myApp.Resources.Where(x => x.ResourceType == typeof(Employee).Name).Select(x => x).ToList());


    I did however notice the ScheduleView was not scrolling in both directions with either Day or Week view activated. I had to manually adjust the ScheduleView.HorizontalOffset/VerticalOffset.
  8. Steve
    Steve avatar
    6 posts
    Member since:
    Apr 2011

    Posted 09 May 2011 Link to this post

    I added the Boolean to my call but nothing happens.  The calendar still starts out on the current date.

     

    Is there a timing issue here?  I am doing this in the MainPage constructor, right after the ViewModel object is created.  It’s likely that the visual tree has not yet been fully constructed, so perhaps that is an issue.  I also tried wrapping ScrollIntoView() in a Dispatcher.BeginInvoke, but there was no difference.

  9. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 11 May 2011 Link to this post

    Hello Steve,

    Please set also CurrentDate property of the RadScheduleView, so that the appointment to be loaded in the view before calling ScrollIntoView() method.

    Hope this helps.

    Greetings,
    Yana
    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
  10. Jayadev
    Jayadev avatar
    3 posts
    Member since:
    May 2011

    Posted 12 May 2011 Link to this post

    Hi,

    I am facing a similar problem, I need to set the vertical scrollbar to 8:00AM rather than 12:00AM, I have written the below piece of code, but it doesn't seem to work, any suggestions. it would be nice if you could send a sample code.

      private void ScheduleView_VisibleRangeChanged(object sender, System.EventArgs e)
            {
                if (ScheduleView != null)
                {
    		timeSpan = TimeSpan.FromTicks(ScheduleView.CurrentDate.AddHours(8).Ticks); //current day default to
    		12:00AM so added 8 hours.
                    ScheduleView.ScrollTimeRuler(timeSpan, true);              //tried this too. //ScheduleView.ScrollIntoView((ScheduleView.AppointmentsSource as ObservableCollection<Event>)[0], true);             }         }

    your quick response would be appreciated.

    Thanks,
    Jayadev
  11. Jayadev
    Jayadev avatar
    3 posts
    Member since:
    May 2011

    Posted 12 May 2011 Link to this post

    Got it!

    I had to write the piece of code in ScheduleView_LayoutUpdated event handler, and it works.

      private bool _shouldUpdate = true;
            private void ScheduleView_LayoutUpdated(object sender, EventArgs e)
            {
                if (ScheduleView != null && ScheduleView.ActiveViewDefinition is DayViewDefinition && _shouldUpdate)
                {
                    _shouldUpdate = false;
                    TimeSpan timeSpan = TimeSpan.FromTicks(DateTime.MinValue.AddHours(8).Ticks);
                    ScheduleView.ScrollTimeRuler(timeSpan, true);
                }
            }
    
    
  12. loowool
    loowool avatar
    60 posts
    Member since:
    Sep 2006

    Posted 08 Aug 2011 Link to this post

    A faster version that does not use a global variable:
    private void ScheduleView_LayoutUpdated(object sender, EventArgs e)
    {
        if (ScheduleView != null && ScheduleView.ActiveViewDefinition is DayViewDefinition)
        {
            ScheduleView.LayoutUpdated -= new EventHandler(ScheduleView_LayoutUpdated);
            TimeSpan timeSpan = TimeSpan.FromTicks(DateTime.MinValue.AddHours(8).Ticks);
            ScheduleView.ScrollTimeRuler(timeSpan, true);
        }
    }
  13. test
    test avatar
    17 posts
    Member since:
    May 2007

    Posted 07 Oct 2011 Link to this post

     

    I found that using ScrollTimeRuler can not sustain. If you switch to WeekViewDefinition and switch back. The time scroll setting disappeared. Is there any way the scroll setting can be hold!

    Thanks
    Wei

Back to Top
DevCraft banner