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

ScrollIntoView still not working

3 Answers 164 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
Idan
Top achievements
Rank 1
Idan asked on 31 Oct 2011, 12:17 PM
This issue is similar to this issue.

We're using the RadScheduleView only with MonthViewDefinition. 
There's room on the screen for 4 weeks only (and Oct. 2011, for example, takes 6 weeks: 25/09/2011 is the first week, 30/10/11 is the last).

When the view is scrolled to its top (Showing first 4 weeks), and an appointment is being selected (from an external list, updated via binding of SelectedAppointment) that starts on the 5'th week, ScrollIntoView method does not scroll to the proper week, and the appointment, although being selected, stays off the view.

We're using this attached behavior:
public static class RadSchedule
{
    public static bool GetEnsureVisibilityOfSelectedAppointments(DependencyObject obj)
    {
        return (bool)obj.GetValue(EnsureVisibilityOfSelectedAppointmentsProperty);
    }
 
    public static void SetEnsureVisibilityOfSelectedAppointments(DependencyObject obj, bool value)
    {
        obj.SetValue(EnsureVisibilityOfSelectedAppointmentsProperty, value);
    }
 
    public static readonly DependencyProperty EnsureVisibilityOfSelectedAppointmentsProperty =
        DependencyProperty.RegisterAttached("EnsureVisibilityOfSelectedAppointments", typeof(bool), typeof(RadSchedule), new UIPropertyMetadata(false, EnsureVisibilityChanged));
 
    private static void EnsureVisibilityChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
    {
        if (d == null)
        {
            throw new ArgumentNullException("d");
        }
        var view = d as RadScheduleView;
        if (view == null)
        {
            throw new NotSupportedException("This attached behavior can only be set on a Telerik RadScheduleView.");
        }
 
        var shouldEnsureVisibility = (bool)e.NewValue;
 
        if (shouldEnsureVisibility)
        {
            view.AppointmentSelectionChanged += view_AppointmentSelectionChanged;
        }
        else
        {
            view.AppointmentSelectionChanged -= view_AppointmentSelectionChanged;
        }
    }
 
    static void view_AppointmentSelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
    {
        if (sender == null)
        {
            throw new ArgumentNullException("sender");
        }
        var view = sender as RadScheduleView;
        if (view == null)
        {
            throw new NotSupportedException("This attached behavior can only be set on a Telerik RadScheduleView.");
        }
 
        if (view.SelectedAppointment == null)
        {
            return;
        }
 
        view.ScrollIntoView(view.SelectedAppointment, true);
 
        // this should have solved this issue:
        view.CurrentDate = view.SelectedAppointment.Start.Date;
    }
}


What am I missing? 

Thanks in advance, 
Idan Felix.

3 Answers, 1 is accepted

Sort by
0
Rosi
Telerik team
answered on 31 Oct 2011, 03:08 PM
Hello Idan,

There is a bug with ScrollIntoView method in MonthView that we will do our best to fix for our next version. We are sorry for the inconvenience this causes to you.

As for the CurrentDate property -this will work only if you set the CurrentDate to be a day from a month different than the currently displayed month.

Regards,
Rosi
the Telerik team

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

0
Idan
Top achievements
Rank 1
answered on 31 Oct 2011, 03:39 PM
Thank you so much for a quick reply.
Is there a PITS issue id that I can follow for this? I couldn't find by searching it... I'd also vote it up :) 

Cheers, 
Idan Felix
0
Rosi
Telerik team
answered on 02 Nov 2011, 02:05 PM
Hello Idan,

You can vote here.

Regards,
Rosi
the Telerik team

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

Tags
ScheduleView
Asked by
Idan
Top achievements
Rank 1
Answers by
Rosi
Telerik team
Idan
Top achievements
Rank 1
Share this question
or