How to style TKCalendarMonthTitleCell

4 posts, 0 answers
  1. Benjamin
    Benjamin avatar
    7 posts
    Member since:
    Feb 2013

    Posted 11 Oct 2016 Link to this post

    I would like to style or remove the title bar over the calendar, where the month name appears.

    It is a TKCalendarMonthTitleCell.

    I can't find any property to style it

    Any directions ?

     

  2. Emily
    Emily avatar
    7 posts
    Member since:
    Apr 2016

    Posted 11 Oct 2016 in reply to Benjamin Link to this post

    I removed it with custom renderers - 

    ios:

    public class OverrideCalendarRenderer : Telerik.XamarinForms.InputRenderer.iOS.CalendarRenderer
    {
        protected override void OnElementChanged(ElementChangedEventArgs<RadCalendar> e)
        {
            base.OnElementChanged(e);
            if (Control.Presenter is TKCalendarMonthPresenter)
            {
                (Control.Presenter as TKCalendarMonthPresenter).TitleHidden = true;
            }
        }
    }

    android:

    public class OverrideCalendarRenderer : CalendarRenderer
    {
        protected override void OnElementChanged(ElementChangedEventArgs<RadCalendar> e)
        {
            base.OnElementChanged(e);
            Control.ShowTitle = false;
        }
    }

  3. Andriy
    Andriy avatar
    4 posts
    Member since:
    May 2014

    Posted 28 Jun Link to this post

    Hi all!

    I can't find solution for issue with changing height of TKCalendarMonthTitleCell. How to do that?

  4. Nikolay Demirev
    Admin
    Nikolay Demirev avatar
    136 posts

    Posted 30 Jun Link to this post

    Hi Andriy,

    You could use the following code snippet to set the desired height of the TKCalednarMonthTitleCell:
    [assembly: ExportRenderer(typeof(RadCalendar), typeof(OverrideCalendarRenderer))]
    namespace XFExamples.iOS
    {
        public class OverrideCalendarRenderer : Telerik.XamarinForms.InputRenderer.iOS.CalendarRenderer
        {
            protected override void OnElementChanged(ElementChangedEventArgs<RadCalendar> e)
            {
                base.OnElementChanged(e);
                if (Control.Presenter is TKCalendarMonthPresenter)
                {
                    var presenter = (Control.Presenter as TKCalendarMonthPresenter);
                    presenter.Style.TitleCellHeight = 100;
                }
            }
        }
    }

    I hope this helps.

    Regards,
    Nikolay Demirev
    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