This is a migrated thread and some comments may be shown as answers.
Day view time showed when opened
9 Answers 50 Views
This is a migrated thread and some comments may be shown as answers.
Anders
Top achievements
Rank 1
Anders asked on 31 Aug 2017, 10:02 AM

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?

9 Answers, 1 is accepted

Sort by
0
Stefan Nenchev
Telerik team
answered on 04 Sep 2017, 09:04 AM
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 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
0
Anders
Top achievements
Rank 1
answered on 04 Sep 2017, 12:59 PM

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?

0
Stefan Nenchev
Telerik team
answered on 07 Sep 2017, 11:57 AM
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
0
Glenn Henriksen
Top achievements
Rank 1
answered on 15 Oct 2017, 09:50 PM
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? 
0
Stefan Nenchev
Telerik team
answered on 18 Oct 2017, 02:05 PM
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
0
IanV
Top achievements
Rank 1
answered on 11 Jan 2019, 06:35 PM

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 ?

0
IanV
Top achievements
Rank 1
answered on 11 Jan 2019, 09:48 PM

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);
}
0
Glenn Henriksen
Top achievements
Rank 1
answered on 13 Jan 2019, 07:06 PM

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. 

0
Yana
Telerik team
answered on 15 Jan 2019, 11:54 AM
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
Asked by
Anders
Top achievements
Rank 1
Answers by
Stefan Nenchev
Telerik team
Anders
Top achievements
Rank 1
Glenn Henriksen
Top achievements
Rank 1
IanV
Top achievements
Rank 1
Yana
Telerik team
Share this question
or