Day view time showed when opened

10 posts, 0 answers
  1. Anders
    Anders avatar
    8 posts
    Member since:
    Feb 2017

    Posted 31 Aug 2017 Link to this post

    How do I change which timespan the day view is showing when it is opened?

    I would like it to scroll to the current time when opened, instead of staying at the minimum time for that day.

    Also, has anyone implemented a line showing the current time?

  2. Stefan Nenchev
    Admin
    Stefan Nenchev avatar
    657 posts

    Posted 04 Sep 2017 Link to this post

    Hello Anders,

    With the current implementation of the Xamarin.Forms Calendar, the desired functionalities are not supported out of the box. We have a feature request logged for controlling the first time slot shown - Calendar: Add functionality to scroll to the first available event when in DayView mode. I have increased its priority as per your request. Please follow the item in order to subscribe for automatic notifications.

    In the meantime, you can partially achieve the desired behavior by creating custom renderers and utilizing the native controls. For example, in iOS:

    [assembly: ExportRenderer(typeof(RadCalendar), typeof(DayViewCalendarRenderer))]
    namespace TelerikXamarin.iOS
    {
        public class DayViewCalendarRenderer : CalendarRenderer
        {
            public override bool TrySetViewMode(Telerik.XamarinForms.Input.CalendarViewMode view, bool isAnimated)
            {
                bool hasNavigated = base.TrySetViewMode(view, isAnimated);
                var presenter = Control?.Presenter as TKCalendarDayViewPresenter;
                if (presenter != null)
                {
                    presenter.DayView.EventsView.Interval = Convert.ToDouble(3600 * 0.25);
                    presenter.DayView.EventsView.StartTime = 3600 * 8;
                    presenter.DayView.EventsView.EndTime = 3600 * 22;
                    presenter.DayView.EventsView.Style.LabelFormatter = new NSDateFormatter { DateFormat = "hh:mm" };
     
                    presenter.DayView.EventsView.UpdateLayout();
                  
                }
     
                return hasNavigated;
            }
        }
    }

    I have attached a sample for your reference.

    Regards,
    Stefan Nenchev
    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
  3. Anders
    Anders avatar
    8 posts
    Member since:
    Feb 2017

    Posted 04 Sep 2017 Link to this post

    Hello Stefan, thanks for the reply.

    Your suggestion solves how many hours is visible, thank you for that.

    What I am more interested in is how to scroll to the current time when the calendar is opened.

    Even better would be an option to show a line with the current time as well.

    Is this possible?

  4. Stefan Nenchev
    Admin
    Stefan Nenchev avatar
    657 posts

    Posted 07 Sep 2017 Link to this post

    Hello Anders,

    Unfortunately, these functionalities are not available. I have added your requirement to the feature request so we can consider implementing them as well.

    Regards,
    Stefan Nenchev
    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
  5. Glenn Henriksen
    Glenn Henriksen avatar
    8 posts
    Member since:
    Jul 2012

    Posted 15 Oct 2017 Link to this post

    It's really weird that this is not implemented. In what world is the primary use case would I want to see the appointments from 00:00 am to 08:00 am first? 
  6. Stefan Nenchev
    Admin
    Stefan Nenchev avatar
    657 posts

    Posted 18 Oct 2017 Link to this post

    Hello, Glenn,

    Indeed, it seems more intuitive to set the starting time to a more convenient time in the morning considering the business hours. We have logged the task at our end and will consider implementing it at some point. Here is the public item which you can track - Calendar: Change default time period. I have added some points to your account for the suggestion. You can follow the item in order to subscribe for automatic notifications.

    Regards,
    Stefan Nenchev
    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
  7. IanV
    IanV avatar
    22 posts
    Member since:
    Dec 2008

    Posted 11 Jan Link to this post

    Hi Guys,

     

    Another year has past. Is there any way to get the iOS Calendar in Xamarin.Forms to scroll to an appointment or at least to DateTime.Now ?

  8. IanV
    IanV avatar
    22 posts
    Member since:
    Dec 2008

    Posted 11 Jan Link to this post

    Workaround:

    When the view changes, find the earliest appointment, then set the Calendar's DayStartTime to an hour or so before that appointment This will make it look like the calendar scrolled and since there are no earlier appointments, nothing is hidden:

     

    if (firstAppointmentOfTheDay != null)
    {
        Calendar.DayViewSettings.DayStartTime = new TimeSpan(0, firstAppointmentOfTheDay.StartDate.AddHours(-2).Hour, 0, 0);
    }
    else
    {
        //If there are no items for the day, then just show 6am
        Calendar.DayViewSettings.DayStartTime = new TimeSpan(0, 6, 0, 0);
    }
  9. Glenn Henriksen
    Glenn Henriksen avatar
    8 posts
    Member since:
    Jul 2012

    Posted 13 Jan Link to this post

    Yeah, that works great. Until the user slides to the next day (or more) and the calendar jumps up and down depending on where the appointments are. Or until you come to a day with the first appointment at 3PM and you want to add an appointment at 10AM. 

    Seriously, I can't belive this is not implemented yet. 

  10. Yana
    Admin
    Yana avatar
    4786 posts

    Posted 15 Jan Link to this post

    Hi all,

    I agree scrolling the view to a specific appointment / time is important functionality and we will definitely look into ways to implement it soon.

    I am sorry for the caused inconvenience due to the missing feature in RadCalendar control.

    Regards,
    Yana
    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
Back to Top