How to add custom data to TKCalendarEvent/TkCalendarEventProtocol

4 posts, 0 answers
  1. Tracy
    Tracy avatar
    7 posts
    Member since:
    Aug 2014

    Posted 02 Aug Link to this post

    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?


  2. Wojciech
    Wojciech avatar
    5 posts
    Member since:
    Jul 2016

    Posted 03 Aug in reply to Tracy Link to this post

    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.


  3. DevCraft banner
  4. Tracy
    Tracy avatar
    7 posts
    Member since:
    Aug 2014

    Posted 03 Aug in reply to Wojciech Link to this post

    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!



  5. Adrian
    Adrian avatar
    160 posts

    Posted 05 Aug Link to this post

    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.

    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
Back to Top
DevCraft banner