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

TKCalendar Disable deselection for Cell

1 Answer 110 Views
Calendar - Xamarin.iOS
This is a migrated thread and some comments may be shown as answers.
avinash
Top achievements
Rank 1
avinash asked on 10 Jun 2019, 08:45 AM

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.

 

Thanks,

Avinash

1 Answer, 1 is accepted

Sort by
0
Lance | Senior Manager Technical Support
Telerik team
answered on 10 Jun 2019, 11:14 PM
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,

Regards,
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
Tags
Calendar - Xamarin.iOS
Asked by
avinash
Top achievements
Rank 1
Answers by
Lance | Senior Manager Technical Support
Telerik team
Share this question
or