TKCalendar Disable deselection for Cell

2 posts, 0 answers
  1. avinash
    avinash avatar
    6 posts
    Member since:
    Dec 2018

    Posted 10 Jun 2019 Link to this post

    Hi Team,


    I am using TKCalendar and want to know how can I disable deselection of any selected date?

    Kindly provide if any possible way.




  2. Lance | Manager Technical Support
    Lance | Manager Technical Support avatar
    1147 posts

    Posted 10 Jun 2019 Link to this post

    Hi Avinash,

    You can find a code example of how to prevent a date selection in the TKCalendar Selection documentation article.

    Scroll down until you see the sentence "You can prevent TKCalendar from selecting specific date by handling the calendar:shouldSelectDate:" and you'll find the ShouldSelecteDate method example:

    public override bool ShouldSelectDate(TKCalendar calendar, NSDate date)
        Console.WriteLine($"Trying to select the unselectable {date}");
        return !TKCalendar.IsDate(main.UnselectableDate, date, NSCalendarUnit.Year | NSCalendarUnit.Month | NSCalendarUnit.Day, main.CalendarView.Calendar);

    This method would be defined in your CalendarDelegate. If you have not set one up and are using the default, I recommend reviewing the official demos that implement this example.

    If you want to skip loading the examples and only want to see the code, you can go right to the Selection demo's file:

    You'll find the ShouldSelectDate method on line 101.

    If you have any further issues, please open a ticket so that the iOS development team can assist further,

    Lance | Technical Support Engineer, Principal
    Progress Telerik
    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