Hide Title in RadCalendar
Environment
Product Version | 2018.3.1109 |
Product | Calendar for Xamarin Cross-Platform |
Description
RadCalendar for Xamarin.Forms does not provide direct API for removing the Title (e.g: November 2018) of the current view, still you could implement it natively for Android and iOS through custom renderers. The code below shows sample implementations for hiding the Calendar Title:
Solution
- For Android you would need to set ShowTitle property:
public class CustomCalendarRenderer : CalendarRenderer
{
protected override void OnElementChanged(ElementChangedEventArgs<RadCalendar> e)
{
base.OnElementChanged(e);
if (this.Control != null)
{
this.Control.ShowTitle = false;
}
}
}
- For iOS you would need to get TKCalendarMonthPresenter and set its TitleHidden property:
public class CustomCalendarRenderer : 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;
}
}
}