This is a migrated thread and some comments may be shown as answers.

How to add custom data to TKCalendarEvent/TkCalendarEventProtocol

3 Answers 34 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Tracy
Top achievements
Rank 1
Tracy asked on 02 Aug 2016, 08:47 PM

I am using the inline events feature with the monthPresenter(presenter: TKCalendarMonthPresenter, inlineEventSelected event: TKCalendarEventProtocol), but i need to be able to store additional information about each event so I can retrieve the event in this event when it is fired.

How can I add more date to the TKCalendarEvent/TKCalendarEventProtocol?

 

3 Answers, 1 is accepted

Sort by
0
Wojciech
Top achievements
Rank 1
answered on 03 Aug 2016, 08:14 AM

Hi Tracy,

I had the same problem. I've created my own version of the TKCalendarEvent class (created new class that inherits from it), and I've added there new properties. I've actually created several different new classes each for specific type of event. Then, objects of the new classes were returned by the data source:

public override TKCalendarEventProtocol[] EventsForDate(TKCalendar calendar, NSDate date)

{

      return new [] { new MyNewCalendarEvent(...), ... };

}

I hope this helps.

Wojtek

0
Tracy
Top achievements
Rank 1
answered on 03 Aug 2016, 01:06 PM

Hi Wojtek,

Thank you so much for your help!

I created a new class called CalEventTK that inherits from TKCalendarEvent and added a new property.

I can't figure out the correct syntax to override the TKCalendarEventProtocol like you have in your example and how the actual event should be structured.

Any help is greatly appreciated!

 

 

0
Adrian
Telerik team
answered on 05 Aug 2016, 12:57 PM
Hi, Tracy,

Thank you for writing.

As Wojciech mentioned the correct way to achieve this scenario is to subclass TKCalendarEvent and add additional properties. Then you could use TKCalendarDataSource to populate the calendar with your custom events. An example can be found in our documentation.

I hope this helps.

Regards,
Adrian
Telerik by Progress
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
Tags
Calendar
Asked by
Tracy
Top achievements
Rank 1
Answers by
Wojciech
Top achievements
Rank 1
Tracy
Top achievements
Rank 1
Adrian
Telerik team
Share this question
or