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

Scrolling help

9 Answers 118 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
hardik
Top achievements
Rank 1
hardik asked on 18 Apr 2011, 07:48 AM
Hi telerik,

After giving appointment source to schedulerView scrolling set to 12:00 am by default. When I create or update any appointment at that time every time scroll set to 12:00 am and I have to scroll it to time where I create\update appointment.

I am using public void ScrollTimeRuler(TimeSpan time, bool alignToTopLeft) method. But I don't want to update the time ruler when I create\update any appointment. I just want to set the time to current time when schedulerView is loaded. So i have used above method and pass the current time so it works fine.

But after creating appointment I don't call this method then also scroll reaches to 12:00 am by default.

I want when I create\update appointment at that time no scrolling. How it can be possible?

Thanks
Hardik

9 Answers, 1 is accepted

Sort by
0
Rosi
Telerik team
answered on 21 Apr 2011, 08:25 AM
Hello Hardik,

After creating an appointment the scroll position of the time ruler should not be changed. You can see that in the attached movie and in our online examples. As we are not able to reproduce the described problem locally I suggest you send us sample running project that we can test and debug.

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
hardik
Top achievements
Rank 1
answered on 22 Apr 2011, 03:22 PM
Hi Rosi,

Thanks for early reply. As i have seen your video I create a sample application and find its working find.

I think problem is I use MVVM pattern. I bound the appointments from xaml. and add appointments dynamically in appointmentSource.

 this.XamlViewModel.Appointments.AddRange(appointments); just befor this i clear all appointments.

 this.XamlViewModel.Appointments.Clear();

IF I not clear the appointments then scrolling is at position, but the problem is appointments are multiplied each time. I mean first time it shows 2 apopointments after that 4 then 6 so on....something happen with schedulerView that's why its set scroll to 12:00 am.

I am not able to identify why it scroll to 12:00 am.So i have one solution is that I stop the scrolling.

So is it possible that I stop the scrolling any how..???

Thanks
Hardik
0
Rosi
Telerik team
answered on 25 Apr 2011, 11:14 AM
Hi Hardik,

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));
        }        
    }




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
0
hardik
Top achievements
Rank 1
answered on 25 Apr 2011, 12:14 PM
Hi rosi,

I have tried with your code, but not get success. Can you please provide some information about this.?

1. What is the type of Appointments?
2. What should be the "time" pass in GenerateAppointments method?

I have used your code as follow.

 this.XamlViewModel.Appointments.AddRange(appointmnets);
this.XamlViewModel.Appointments.Remove(item1 => app.Contains(item1));

Appointments is the ObservableAppoitnmentCollection.here I got the error "can not convert lambda expression to type 'Telerik.windows.controls.schedulerView.appointment' because it is not a delegate type."

Can you please provide some general idea.?

Thanks
Hardik
0
Rosi
Telerik team
answered on 28 Apr 2011, 10:11 AM
Hello Hardik,

Please find the attached project that works as expected at our side.
The main idea is not to use the Clear method and remove the items by different way.

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
hardik
Top achievements
Rank 1
answered on 28 Apr 2011, 03:26 PM
Hi telerik,

Thanks for sample project. But its not open and gives few errors.


I have tried in my application with this logic, It works but when i use resource group than as per that resources their reservations are not shown.

Thanks
Hardik
0
Michael
Top achievements
Rank 1
answered on 28 Apr 2011, 06:14 PM
Where is the function:  ScrollTimeRuler ?  I couldn't find it in the docs or by googling it.

I think I have a similiar question.  I have a scheduleView control that can not fit in the space provided, so it has a scrollbar.  I bind to an appointmentSource.  When the appointment source updates, the ScheduleView control redraws and goes to the top of the day.  Is it possible to have the control automatically scroll down the new appointment added to the day?

0
hardik
Top achievements
Rank 1
answered on 03 May 2011, 01:50 PM
HI Michael,

You can access the function as follow.

 this.XamlRadScheduleView.Dispatcher.BeginInvoke(() =>
      {
        this.XamlRadScheduleView.ScrollTimeRuler(time, alignToTopLeft);
      });

Here as a time you should pass the time where you want to set your scroll viewer. If you want to set it to time where your reservation is created then take one global variable to creating event of appointment., And then pass this variable to above function.

Thanks
HArdik
0
Rosi
Telerik team
answered on 05 May 2011, 08:26 AM
Hello Hardik,

You can find attached an updated project containing resources.The project illustrates that the scroll position is not lost after changing the AppointmentsSource.

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
hardik
Top achievements
Rank 1
Answers by
Rosi
Telerik team
hardik
Top achievements
Rank 1
Michael
Top achievements
Rank 1
Share this question
or