Hey Telerik team,
You were a big help before with the SideMenu SetHighlight so now I have 3 questions regarding the Calendar:
1. Currently in ViewWillAppear I style my calendar after creating it yet the theme/view mode/etc still changes after the view is presented to the screen. Is there a way to make this not happen and be styled before presenting to the screen? I've tried to style the calendar before adding the SubView but it still does the same thing.
2. I've tried to make the calendar day cells in a custom cell only display a number below the date (On both the iPad theme and standard theme). Unfortunately I can't find a way to do this - I have a custom cell but the events will display colored circles and things such as - 1 more... below. I'd like to make this just display "3" or "6". I've tried to set the maximum number of events to zero but that seems to ignore it completely.
3. Last, the calendar seems to load slowly with the events. Is there a way to have the events set before going to the calendar so that the load time is near instant?
In case a photo helps, I'd like to make the calendar look like this but with a number instead of a circle below the date:
Thanks so much!
6 Answers, 1 is accepted
In order to give you any guidelines on the difficulties you are facing I would need a code snippet of the way you are customizing the calendar and the implementation of the custom day cell. You can also check the customization and populating with data articles in our documentation. There you will find explanation with code snippets on these topics.
Telerik by Progress
I've seen both those articles which is how I currently have my app set up. For the DataSource class there is EventsForDate which seems to be called when the Calendar is created (and not pushed to the screen). This creates slow loading for the user and results in the calendar pausing at the styling (where it changes the theme to iPad & pushes the events to the screen). I'd like to make this faster - where it only loads events on the month they are presented rather than every potential event. There is a potential for our app to have many many events. Would you know of a way to do this?
In terms of styling & presentation, when I create the calendar I set the theme to the iPad theme as it shows the "n more..." text. I'd like to remove the event circles and replace them just with the text of "n more.." on the non iPad theme - is there a way to do this? Setting the MaxEventsPerDate to zero seems to have it ignored.
Loading events just for the presented month can be achieved by implementing TKCaledarDelegate's method WillNavigateToDate. You can check the month of the date that the calendar is going to navigate and if it is different than the current month invoke the Update method of the calendar's presenter. This would request again EventsForDate. This way you can load only the events of interest.
You can remove the circle by setting size of the EventShape property of TKCalendarDayCellStyle to CGSize.Empty and draw the events as text like in the code below:
I can confirm that currently we have an issue with setting the MaxEventsCount property. I have logged it and updated your Telerik points for reporting this.
Telerik by Progress
Thanks so much. I am nearing the UI I want with the Telerik Control.
In order to complete this - is there anyway to draw the selection circle before DidSelectDate? Reason being is that when the user taps a date I have the calendar close (this is intended) - but there's no selection circle until you have actually selected a date. Drawing a selection circle or tinting the specific cell would be ideal (such as WillSelectDate but this seems to not exist in the TKCalendarDelegate).
Thank you as always,
I've also noticed that setting the DisplayEventAsText as true does not let me use EventAlignment (I'd like to center the text at the bottom, and horizontally). Is there a way to center the EventText? Once again I've tried a few options and reading the API doc but had not seen anything. Apologies for the formatting. The TextAlignment works fine if I were to change the date display for a cell.
1. An event that is called before DidSelectDate is ShouldSelectDate. You should return a boolean that indicates if the date should be selected:
2. Yes, I can confirm that the text alignment doesn't apply when displaying events as text. Currently a possible option is to use the EventInsets property of the day cell's style.
Telerik by Progress