Hi,
I follow the tutorial on the documentation but i have a little problem and i can't solve it ...
if (!(calendarCell is CalendarDayCell))
{
return;
}
This function always return. I don't understand what does this test mean and why it does not success
Hope you can help me !
Thanks
8 Answers, 1 is accepted
Thank you for contacting the Android team!
The cells in year mode are represented by CalendarMonthCell and in month and week mode by CalendarDayCell.
Thank you for your time and all best!
Regards,
Antony Jekov
Telerik
See What's Next in App Development. Register for TelerikNEXT.

Hello Antony, thanks for your reply !
I am actually in week mode so it shoud be CalendarDayCell right ?
Thanks
Jérémy
Yes, and you can check further by using getCellType() to check if the cell is Date, DayName or WeekNumber.
Regards,
Antony Jekov
Telerik
See What's Next in App Development. Register for TelerikNEXT.

Ok, so why it doesn't work ?
When i click on a Cell, the test always return false, i don't understand why ..
I confirmed that this code doesn't work indeed. It is supposed to work according to the official documentation of the keywords in the .NET platform - Reference here, but it seems that Mono or Xamarin are behaving differently. I will log this and the examples will be revisited regarding this issue.
Thank you for your feedback!
Regards,
Antony Jekov
Telerik
See What's Next in App Development. Register for TelerikNEXT.

Hi,
As same for the GetFormattedTime function, String doesn't work , you should use string with lowcase, and it's work.
Like this :
private string GetFormattedTime(string format, long time)
{
Calendar calendar = Calendar.Instance;
calendar.TimeInMillis = time;
DateTime dateTime = new DateTime(
calendar.Get (CalendarField.Year),
calendar.Get (CalendarField.Month) + 1,
calendar.Get (CalendarField.DayOfMonth),
calendar.Get (CalendarField.HourOfDay),
calendar.Get (CalendarField.Minute),
calendar.Get (CalendarField.Second));
return string.Format (format, dateTime);
}
Jérémy
Thank you for your feedback. We will review it at our earliest convenience.
Thank you for your time and all best!
Regards,
Antony Jekov
Telerik

I just had this issue resolved today in the event that someone else encounters this problem. This is what I was told to do:
Instead of:
if(!(calendarCell is CalendarDayCell))
{
return;
}
CalendarDayCell calendarDayCell = (CalendarDayCell) calendarCell;
You need to use:
if (calendarCell.Class.SimpleName == "CalendarMonthCell") {
return;
}
CalendarDayCell calendarDayCell = calendarCell.JavaCast<CalendarDayCell> ();