Completed
Last Updated: 23 Jul 2019 05:09 by ADMIN
Release 2019.2.708 (R2 2019 minor release)
IanV
Created on: 02 Jan 2019 01:28
Category: Calendar & Scheduling
Type: Bug Report
4
Calendar [iOS]: ScrollAppointmentIntoView() Doesn't Scroll

In Xamarin Forms.

 

When I call Calendar.ScrollAppointmentIntoView(theItem); in Android it works fine.

 

In iOS when the same call is made, the calendar scrolls about 1 pixel, then stops.

I put the call into a timer just to make sure it's there.

      Device.StartTimer(TimeSpan.FromMilliseconds(3000), () =>    

              { Device.BeginInvokeOnMainThread(() => {  Calendar.ScrollAppointmentIntoView(theItem); });             

                 return false; // True = Repeat again, False = Stop the timer    

      });

 

3 comments
ADMIN
Lance | Senior Manager Technical Support
Posted on: 02 Jan 2019 18:06
Hi Ian,

Thank you for the code, I can replicate the issue and converted this thread to a Bug Report. The development team will review this soon and update the status of the case. You have been subscribed to the issue and will get a notification when the development team updates the issue's status.

Unfortunately, I do not have a suitable workaround at this time. I apologize for any inconvenience this may cause while we work towards a solution.


Reproducible

View

             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:local="clr-namespace:ScrollIntoViewTest.Portable"
             xmlns:telerikInput="clr-namespace:Telerik.XamarinForms.Input;assembly=Telerik.XamarinForms.Input"
             x:Class="ScrollIntoViewTest.Portable.MainPage">
 
    <ContentPage.BindingContext>
        <local:ViewModel x:Name="PageViewModel"/>
    </ContentPage.BindingContext>
 
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
 
        <telerikInput:RadCalendar x:Name="calendar" NativeControlLoaded="CalendarLoaded"  AppointmentsSource="{Binding Items}">
            <telerikInput:RadCalendar.DayViewStyle>
                <telerikInput:DayViewStyle AllDayAppointmentBackgroundColor="Blue"  AllDayAppointmentTextColor="White"  AllDayAppointmentFontSize="12" TimelineLabelsTextColor="DarkGray" TimelineLabelsFontSize="10" AppointmentFontSize="12" AppointmentDetailsFontSize="10" />
            </telerikInput:RadCalendar.DayViewStyle>
        </telerikInput:RadCalendar>
 
        <Button Grid.Row="1" Text="Scroll To Appointment" Margin="5" Clicked="Button_OnClicked"/>
    </Grid>
</ContentPage>

Code behind and View Model

using System;
using System.Collections.ObjectModel;
using System.Linq;
using Telerik.XamarinForms.Input;
using Xamarin.Forms;
 
namespace ScrollIntoViewTest.Portable
{
    public partial class MainPage : ContentPage
    {
        public MainPage()
        {
            InitializeComponent();
        }
 
        private void CalendarLoaded(object sender, EventArgs e)
        {
            (sender as RadCalendar).TrySetViewMode(CalendarViewMode.MultiDay);
        }
         
        private void Button_OnClicked(object sender, EventArgs e)
        {
            calendar.ScrollAppointmentIntoView(PageViewModel.Items.LastOrDefault());
        }
    }
 
    public class ViewModel
    {
        public ViewModel()
        {
            Items = new ObservableCollection<IAppointment>(Enumerable.Range(1,10).Select(i => new Appointment
            {
                StartDate = DateTime.Now.AddHours(-i - 1),
                EndDate = DateTime.Now.AddHours(-i),
                Title = $"Item {i}",
                Detail = $"This is appointment for item {i}."
            }));
        }
 
        public ObservableCollection<IAppointment> Items { get; set; }
    }
 
    public class Appointment : IAppointment
    {
        public DateTime StartDate { get; set; }
        public DateTime EndDate { get; set; }
        public string Title { get; set; }
        public Color Color { get; set; }
        public bool IsAllDay { get; set; }
        public string Detail { get; set; }
    }
}

Regards,
Lance | Tech Support Engineer, Sr.
Progress Telerik
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 Feedback Portal and vote to affect the priority of the items
IanV
Posted on: 02 Jan 2019 16:15

Xamarin Forms 3.4, Telerik newest as of today

IAppointment objects (as is)

XAML:

[REDACTED BY TELERIK SUPPORT]

<input:RadCalendar x:Name="calendar"     IsVisible="{Binding IsLoading, Converter={StaticResource NegateBooleanConverter}}"                    NativeControlLoaded="CalendarLoaded"                    AppointmentTapped="Calendar_OnAppointmentTapped"                    SelectionChanged="Calendar_OnSelectionChanged"                    DisplayDateChanged="Calendar_OnDisplayDateChanged"                    ViewChanged="Calendar_OnViewChanged"                    AppointmentsSource="{Binding Items}">   <input:RadCalendar.DayViewStyle><input:DayViewStyle AllDayAppointmentBackgroundColor="Blue"                            AllDayAppointmentTextColor="White"                            AllDayAppointmentFontSize="12"                            TimelineLabelsTextColor="DarkGray"                            TimelineLabelsFontSize="10"                            AppointmentFontSize="12"                            AppointmentDetailsFontSize="10"/></input:RadCalendar.DayViewStyle></input:RadCalendar>

[REDACTED BY TELERIK SUPPORT]

 

ADMIN
Lance | Senior Manager Technical Support
Posted on: 02 Jan 2019 13:30
Hi Ian,

In order for me to investigate this further, can you please reply with the following information:

- What is the Xamarin.Forms version?
- What is the Telerik UI for Xamarin version?
- Please share the code for that page/view, I'll particularly need to see the Calendar's parental structure
- One example of the appointment object that you use.

OR

- Reply with a demo project that reproduces the problem, this will answer all the above questions at once. (Note: since this is a forum thread, you'll need to put the project somewhere like OneDrive/Dropbox and share a link for me to download it)


Next Steps

With this information, I'll attempt to reproduce the problem in an isolated project and escalate to the development team.

Regards,
Lance | Tech Support Engineer, Sr.
Progress Telerik
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 Feedback Portal and vote to affect the priority of the items