Thanks for the quick reply!
I tried running your code. If you press the button when in year view, the code does not work. I had to modify it like this:
public partial class MainPage : ContentPage
{
public MainPage()
{
InitializeComponent();
btn.Clicked += Btn_Clicked;
}
private void Btn_Clicked(object sender, EventArgs args)
{
calendar.ViewMode = ViewMode.MonthView;
calendar.MoveToDate = DateTime.Now.Date;
}
}
Even after adding the calendar.ViewMode = ViewMode.MonthView;, I still find that in Android, if in year view, the calendar just switches to month view, and stays on June of the year it was on...
I am using v16.1.0.37 of sfcalendar, and Xamarin.Forms 3.0.0.446417.
Any other suggestions?
Update: I found a good work-around for anyone else who runs into this issue. I noticed that when in year view, if I clicked on "current date" the calendar would always just jump to June of whatever year is in. If then clicked the button again, nothing would happen. However, if I then scrolled to a different month, and pressed the button, the view would go to the correct day/month. Thus, with that in mind, I modified my code as follows:
private void CurrentDate_Clicked(object sender, Syncfusion.SfCalendar.XForms.CalendarTappedEventArgs args)
{
if (Calendar.ViewMode == ViewMode.YearView)
{
Calendar.ViewMode = ViewMode.MonthView;
DependencyService.Get().Backward();
Calendar.MoveToDate = DateTime.Now;
}
else
{
Calendar.MoveToDate = DateTime.Now;
}
}
By forcing the calendar to move to new month when in month view, everything now seems to work in Android.
However, unfortunately, in UWP, the months and dates still seem to get messed up (e.g. if I move back to May, May 1st is suddenly a Sunday instead of Tuesday). This behavior is very strange, but quite repeatable.
Any comments on this behavior or how to fix it would be appreciated!