This is a migrated thread and some comments may be shown as answers.
Change the text "ALL-DAY"
3 Answers 7 Views
This is a migrated thread and some comments may be shown as answers.
Anders
Top achievements
Rank 1
Anders asked on 06 Sep 2017, 08:38 PM

How do I change the text "ALL-DAY" on the dayview?

Kind regards,

Anders

3 Answers, 1 is accepted

Sort by
0
Anders
Top achievements
Rank 1
answered on 11 Sep 2017, 05:03 AM
Bump 😊
0
Accepted
Nikolay
Telerik team
answered on 11 Sep 2017, 11:00 AM
Hello Anders,

Changing the DayView "ALL-DAY" label text is currently not exposed in Xamarin.Forms. If you would like to see that functionality I encourage you to submit a feature request in our FeedbackPortal.

However you can achieve that behavior by creating a custom CalendarRenderer where you will have access to the native control and you can change the label text. I'm posting simple implementation of CustomCalendarRenderer that should solve your problem:

Android implementation:

public class CustomCalendarRenderer : CalendarRenderer
{
    public override bool TrySetViewMode(CalendarViewMode view, bool isAnimated)
    {
        if (view == CalendarViewMode.Day)
        {
            Control.DayView.AllDayEventsViewStyle.AllDayText = "MY Text";
        }
 
        return base.TrySetViewMode(view, isAnimated);
    }
}


iOS implementation:

public class CustomCalendarRenderer : CalendarRenderer
{
    protected override CalendarDelegate CreateCalendarDelegateOverride()
    {
        return new CustomCalendarDelegate();
    }
}
 
public class CustomCalendarDelegate : CalendarDelegate
{
    public override void DidChangedViewModeFrom(TKCalendar calendar, TKCalendarViewMode previousViewMode, TKCalendarViewMode viewMode)
    {
        base.DidChangedViewModeFrom(calendar, previousViewMode, viewMode);
 
        var dayViewPresenter = calendar.Presenter as TKCalendarDayViewPresenter;
        if (dayViewPresenter == null)
        {
            return;
        }
 
        var allDayLabel = dayViewPresenter.DayView.AllDayEventsView.LabelView as UILabel;
        if (allDayLabel != null)
        {
            allDayLabel.Text = "My Text";
        }
    }
}


Here are a few links about how to create a custom renderer:

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
Anders
Top achievements
Rank 1
answered on 11 Sep 2017, 03:51 PM
Thank you! Just what I was looking for
Asked by
Anders
Top achievements
Rank 1
Answers by
Anders
Top achievements
Rank 1
Nikolay
Telerik team
Share this question
or