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

ScheduleView scrolling issue

6 Answers 276 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
Siesta
Top achievements
Rank 1
Siesta asked on 21 Apr 2011, 10:38 AM

Hi,

I'm using ScheduleView to load custom appointments with the Load on demand features. The appointments load fine, but whenever I scroll backward or forward in time (e.g. previous/next week or month) the calendar scrolls back to the top, instead of staying at the time it was scrolled to before navigation.

This also occurs in the RadControls demo; just navigate to Controls -> Data -> Schedule View -> Features -> Load On Demand. Now click Week view. Scroll down to 18:00. Now click the right arrow to navigate to next week. The view scrolls back to the top at 0:00.

Any ideas on how to fix this? I found no method to manually get and set the scrolling position either.

6 Answers, 1 is accepted

Sort by
0
Rosi
Telerik team
answered on 25 Apr 2011, 11:09 AM
Hello Siesta,

The described behavior is causes by the Clear() method of the appointment's collection. When the AppointmentsSource collection is reset the scheduleview regenerates its item and that is why the scroll position is lost.To solve the issue I suggest you avoid the Clear method() and add the new items in a different way.
For example:
private void GenerateAppointments(DateSpan dateSpan)
        {
           var oldItems = this.Appointments.ToList();
          this.Appointments.AddRange(
                from i in Enumerable.Range(0, (dateSpan.End - dateSpan.Start).Days * 24)
                select new Appointment()
                {
                    Subject = "Appointment" + i + " " + dateSpan.Start.AddHours(i).ToShortDateString(),
                    Start = dateSpan.Start.AddHours(i),
                    End = dateSpan.Start.AddHours(i + 1),
                });

            this.Appointments.Remove(item=>oldItems.Contains(item));
        }        
    }


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
0
Siesta
Top achievements
Rank 1
answered on 26 Apr 2011, 09:09 AM

Hi Rosi,

I tried commenting the Clear() call but the calender still resets the view.

Here's a sample of my code:

/// <summary>
/// Gets or sets the afspraken collection
/// </summary>
public ObservableCollection<Appointment> Afspraken
{
    get
    {
        return ( ObservableCollection<Appointment> )GetValue( AfsprakenProperty );
    }
    set
    {
        SetValue( AfsprakenProperty, value );
    }
}
 
/// <summary>
/// Using a DependencyProperty as the backing store for Afspraken.  This enables animation, styling, binding, etc... 
/// </summary>
public static readonly DependencyProperty AfsprakenProperty =
    DependencyProperty.Register( "Afspraken", typeof( ObservableCollection<Appointment> ), typeof( AgendaView ), new UIPropertyMetadata( new ObservableCollection<Appointment>() ) );

Binding in XAML:

<telerik:RadScheduleView  AppointmentsSource="{Binding ElementName=agendaView, Path=Afspraken}" />

And I'm adding appointments by directly adding Appointments to the Afspraken observable collection:

//Afspraken.Clear();
 
foreach( AfspraakSummary summary in result )
{
    // maps AfspraakSummary to Appointment
    Appointment appointment = new Appointment()
    {
        Body = summary.KorteOpmerking,
        Subject = summary.DisplayName,
        Start = summary.DatumStartAfspraak.Value,
        End = summary.DatumEindeAfspraak.Value,
    };
 
    Afspraken.Add( appointment );
}

Note that I use my own appointment (AfspraakSummary) object and map it to a telerik Appointment

0
Rosi
Telerik team
answered on 29 Apr 2011, 08:14 AM
Hi Siesta,

Please find the attached project that works as expected at our side.
I suggest you review it and find the differences at your side.You can modify is so the problem to appear and send it back to us to test it locally.


Kind 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
0
Jan
Top achievements
Rank 1
answered on 29 Apr 2011, 10:46 AM

0
Siesta
Top achievements
Rank 1
answered on 29 Apr 2011, 12:19 PM
Hi Rosi,


Perhaps I've not been specific enough about the issue. I linked some screenshots of your attached project to see what it looks like on my computer and what behavior I expect.


http://img685.imageshack.us/img685/3174/telerik1.png
http://img508.imageshack.us/img508/8089/telerik2.png
http://img849.imageshack.us/img849/955/telerik3.png
http://img26.imageshack.us/img26/9562/telerik4.png

Screenshot 1 shows the application's default state when I run it.

Screenshot 2 is when I scrolled down to the last day of the week.

Screenshot 3 shows what happened when I clicked the Next week button at the top right. Notice the view has been scrolled to the top and not fully showing the last day of the week.

Screenshot 4 shows the behavior I expected (view stays in current scrolling position and not resetting)


This scrolling behavior becomes more apparent when I zoom in more (higher ActiveViewDefinition.MinTimeRulerExtent)
0
Rosi
Telerik team
answered on 05 May 2011, 03:42 PM
Hi Jan,

Thank you for the provided images. I understand the problem now. However when the current view is changed the days and resource groups of RadScheduleView are recreated.That is why the scroll position is lost. You can use the ScrollIntoView() method to set the scroll position to specific DateTime or Appointment when the view is changed. You can hook on the VisibleRangeChanged event and call the method there.

Hope this helps.

Kind 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
Tags
ScheduleView
Asked by
Siesta
Top achievements
Rank 1
Answers by
Rosi
Telerik team
Siesta
Top achievements
Rank 1
Jan
Top achievements
Rank 1
Share this question
or