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

Scroll appointment into view

11 Answers 300 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
Oscar Wahlen
Top achievements
Rank 1
Oscar Wahlen asked on 02 May 2011, 09:44 AM
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).

11 Answers, 1 is accepted

Sort by
0
Accepted
Konstantina
Telerik team
answered on 03 May 2011, 11:12 AM
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
0
Steve
Top achievements
Rank 1
answered on 03 May 2011, 04:35 PM
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.
0
Accepted
Konstantina
Telerik team
answered on 05 May 2011, 08:56 AM
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
0
Steve
Top achievements
Rank 1
answered on 05 May 2011, 12:54 PM
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) _
                )
0
Oscar Wahlen
Top achievements
Rank 1
answered on 09 May 2011, 09:05 AM
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.
0
Steve
Top achievements
Rank 1
answered on 09 May 2011, 11:51 AM

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.

0
Yana
Telerik team
answered on 11 May 2011, 08:18 AM
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
0
Jayadev
Top achievements
Rank 1
answered on 12 May 2011, 08:11 AM
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
0
Jayadev
Top achievements
Rank 1
answered on 12 May 2011, 09:56 AM
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);
            }
        }

0
loowool
Top achievements
Rank 2
answered on 08 Aug 2011, 10:38 AM
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);
    }
}
0
test
Top achievements
Rank 1
answered on 08 Oct 2011, 03:36 AM

 

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

Tags
ScheduleView
Asked by
Oscar Wahlen
Top achievements
Rank 1
Answers by
Konstantina
Telerik team
Steve
Top achievements
Rank 1
Oscar Wahlen
Top achievements
Rank 1
Yana
Telerik team
Jayadev
Top achievements
Rank 1
loowool
Top achievements
Rank 2
test
Top achievements
Rank 1
Share this question
or