3 Answers, 1 is accepted
0
Anders
Top achievements
Rank 1
answered on 11 Sep 2017, 05:03 AM
Bump 😊
0
Accepted
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:
iOS implementation:
Here are a few links about how to create a custom renderer:
I hope I've been helpful.
Regards,
Nikolay
Progress Telerik
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