Decorate cells with specif color

Thread is closed for posting
2 posts, 0 answers
  1. Fabio
    Fabio avatar
    20 posts
    Member since:
    Apr 2015

    Posted 21 May 2015 Link to this post


    I want to achieve something similar to this:

    I am using the UI fo Xamarin forms but I am using a custom renderer, in the Android version I have extended the CalendarDayCell:

    Here is my custom renderer:

    public class CustomCalendarRenderer : ViewRenderer<CustomCalendar, TKCalendar>
            CustomCalendar calendar;
            TKCalendar calendarView;
            protected override void OnElementChanged(ElementChangedEventArgs<CustomCalendar> e)
                    if (e.NewElement == null)
                    calendar = e.NewElement;
                    calendarView = new TKCalendar(this.Bounds);
                    AppointmentCalendarDelegate calendarDelegate;
                    calendarView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
                    calendarDelegate = new AppointmentCalendarDelegate();
                    calendarView.Delegate = calendarDelegate;
                    calendarDelegate.SelectionChanged += calendarDelegate_SelectionChanged;
                    //this.calendarView.MinDate = this.calendar.MinDate.ToNSDate();
                    //this.calendarView.MaxDate = this.calendar.MaxDate.ToNSDate();
                    calendarView.Locale = new NSLocale("es_MX");
                    if (calendar.Type == 2)
                        calendarView.ViewMode = TKCalendarViewMode.Year;
            void calendarDelegate_SelectionChanged(object sender, ValueChangedEventArgs<object> e)
                this.calendar.SelectedDate = (DateTime?)e.NewValue;

     Please let me know your comments/suggestions

  2. Ves
    Ves avatar
    2914 posts

    Posted 27 May 2015 Link to this post

    Hi Fabio,

    You can actually inherit directly from CalendarRenderer and take advantage of all the features already implemented. You will only need to take care of the customizations. Please, find attached a small example.

    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