Day view time showed when opened

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

    Posted 31 Aug 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
    503 posts

    Posted 04 Sep 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 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
    503 posts

    Posted 07 Sep 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
    7 posts
    Member since:
    Jul 2012

    Posted 15 Oct 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
    503 posts

    Posted 5 days and 5 hours ago 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
Back to Top