hi,
In multi day view mode if user swipe left or right calendar changes date by its own (may be force put on calendar)
I need to detect user swipe gesture, below codes aren't firing
<
telerikInput:RadCalendar.GestureRecognizers
>
<
SwipeGestureRecognizer
Swiped
=
"SwipeGestureRecognizer_Swiped"
Threshold
=
"10"
/>
</
telerikInput:RadCalendar.GestureRecognizers
>
any work around ? even in renderers ?
7 Answers, 1 is accepted
Thank you for the provided code.
In order to detect the swiping when the Calendar Date is changed you could use the RadCalendar DisplayDateChanged event. This event is fired when swiping right/left is done - check the attached project for reference. For more details regarding the RadCalendar events, please refer to the following article in our documentation: Calendar events.
I hope this will help.
Regards,
Didi
Progress Telerik

thank you for the pointing display date change event.
changing DisplayDate inside DisplayDateChanged event cause infinite loop inside event, somehow i manage to solve that using timer.
but now i have another issue, calendar is not scroll to the new DisplayDate
bool
swiped =
false
;
private
void
Weekcalendar_DisplayDateChanged (
object
sender, Telerik.XamarinForms.Common.ValueChangedEventArgs<
object
> e)
{
DateTime newdatetime = (DateTime)e.NewValue;
DateTime prevdatetime = (DateTime)e.PreviousValue;
if
((prevdatetime !=
null
|| newdatetime !=
null
) && !swiped)
{
if
(prevdatetime > newdatetime)
{
weekcalendar.DisplayDate.AddDays(-7);
swiped =
true
;
starttimer();
}
else
{
DateTime newdisdate = prevdatetime.AddDays(7);
weekcalendar.DisplayDate = newdisdate;
swiped =
true
;
starttimer();
}
}
}
private
void
starttimer ()
{
Device.StartTimer(TimeSpan.FromSeconds(1), () =>
{
swiped =
false
;
return
false
;
// True = Repeat again, False = Stop the timer
});
}
any other way of setting display date and make the calendar scroll and is it OK to use device timer like this ?
Thank you for the provided code.
I have tested the described scenario and the infinite loop occurs when the ViewMode is MultiDay. It works fine with Week ViewMode.
I am glad to hear that you have found a solution to stop the infinite loop and I think it is okay to use the Device.StartTimer. Also the behavior that you are observing with the nextDate and previousDate when MuliDayView is used is the expected one. The MultiDayView has different behavior while scrolling than the Week View.
MultiDayView:
The MultiDayView visualize 5 days(by default) and keeps 5 days in left and 5 days in right part of the calendar.
WeekView:
The Week ViewModel visualize 7 days and it keeps the previous and next 7 days.
Let me know if I can assist with anything else.
Regards,
Didi
Progress Telerik

well, by simply setting display date it should scroll to that week in multiday view. but the problem in here it is not scroll even display date in calendar has other date. at swiped = true; break point display date is not changed yet, but when the event hit again you can see at first "if" calendar display date changed to what i have setted. but not navigate view.
you can reproduce this behaviour with my code. and i have set multi day calendar visible days to 7 in xaml.

hi,
is there any workaround you can suggest to scroll multiday calendar when changing date ?
Thank you for the detailed explanation of the issue.
I have reproduced the behavior on my side. It seems that the DisplayDate is updated when DayView, WeekView are used. The issue occurs in the MultiDayView. I will need some additional time for further research the case and will write back as soon as I have more information from our side (next week).
Thank you for the understanding.
Regards,
Didi
Progress Telerik
Thank you for your patience.
I have further research the case and it seems that the MultiDay View does not scroll to the DisplayDate when the new DisplayDate is set in DisplayDateChanged event. I have logged an issue on your behalf in our Feedback portal. You could follow the item on the link below:
https://feedback.telerik.com/xamarin/1405180-calendar-android-displaydate-is-not-updated-when-multidayview-is-used
Please find your Telerik points updated as a small sing of gratitude for your involvement.
At this point I could not suggest a workaround for this issue. The severity of the issue comes from the native Android calendar and it makes it more complex. Also I could not commit a time-frame when a possible fix for the issue could be provided.
Let me know if I can assist with anything else.
Regards,
Didi
Progress Telerik