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

How to remove selected date highlight in iOS

2 Answers 182 Views
Calendar - Xamarin.iOS
This is a migrated thread and some comments may be shown as answers.
Dev
Top achievements
Rank 1
Dev asked on 03 May 2018, 02:56 PM

I have a RadCalendar in Week view mode that I'm using to allow users to jump to dates in an events list. The calendar displays indicators for dates that have events in the list. On iOS, if a user taps a date that does not have an indicator, a black highlight appears (see screenshot #1). Tapping a date with an indicator, does not show a highlight (see screenshot #2). On Android, there is no highlight no matter which dates the user taps on (i.e. always looks like screenshot #2).

How can I get rid of the highlight on iOS?

2 Answers, 1 is accepted

Sort by
0
Nikolay
Telerik team
answered on 08 May 2018, 09:59 AM
Hello,

Removing the selected date highlight of the iOS calendar is currently not exposed in Xamarin.Forms. However you can achieve that by creating a custom CalendarRenderer where you will have access to the native control and you can change the shape property of the calendar cell.

I'm posting simple implementation of CustomCalendarRenderer that should solve your problem:

public class CustomCalendarRenderer : CalendarRenderer
{
    protected override CalendarDelegate CreateCalendarDelegateOverride()
    {
        return new CustomCalendarDelegate();
    }
}
 
public class CustomCalendarDelegate : CalendarDelegate
{
    public override TKCalendarCell ViewForCellOfKind(TKCalendar calendar, TKCalendarCellType cellType)
    {
        if (cellType == TKCalendarCellType.Day)
        {
            CustomDayCell cell = new CustomDayCell();
            return cell;
        }
 
        return base.ViewForCellOfKind(calendar, cellType);
    }
}
 
public class CustomDayCell : TKCalendarDayCell
{
    public override void UpdateVisuals()
    {
        base.UpdateVisuals();
        this.Style.Shape = null;
    }
}


I hope I've been helpful.

Regards,
Nikolay
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
0
Dev
Top achievements
Rank 1
answered on 11 May 2018, 07:51 PM
Perfect. Works beautifully. Thanks.
Tags
Calendar - Xamarin.iOS
Asked by
Dev
Top achievements
Rank 1
Answers by
Nikolay
Telerik team
Dev
Top achievements
Rank 1
Share this question
or