Hello! Is there a way to align the stroke of a selected cell? I have problems displaying the selected cell correctly. (Please see attachment)
3 Answers, 1 is accepted
0
Hi Adam,
You can create a custom renderer for the iOS platform and work with the Style property of the TKCalendarDayCell to update its visual appearance.
For example:
Create the custom renderer:
The definition of the Custom Delegate:
And the CustomCell where you can work with the Style property:
Regards,
Stefan Nenchev
Progress Telerik
You can create a custom renderer for the iOS platform and work with the Style property of the TKCalendarDayCell to update its visual appearance.
For example:
Create the custom renderer:
class
CustomCalendarRenderer : CalendarRenderer
{
protected
override
void
OnElementChanged(ElementChangedEventArgs<RadCalendar> e)
{
base
.OnElementChanged(e);
this
.Control.Delegate =
new
CalendarDelegate();
}
}
The definition of the Custom Delegate:
class
CalendarDelegate : TKCalendarDelegate
{
public
override
TKCalendarCell ViewForCellOfKind(TKCalendar calendar, TKCalendarCellType cellType)
{
if
(cellType == TKCalendarCellType.Day)
{
return
new
CustomCell();
}
return
null
;
}
}
And the CustomCell where you can work with the Style property:
public
class
CustomCell : TKCalendarDayCell
{
public
override
void
UpdateVisuals()
{
this
.Style.TextColor = UIColor.Purple;
this
.Style.TextAlignment = TKCalendarCellAlignment.Top;
this
.Style.Shape =
null
;
base
.UpdateVisuals();
}
}
Regards,
Stefan Nenchev
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
Adam
Top achievements
Rank 1
answered on 16 Aug 2017, 02:59 PM
Hello @Stefan What if I want the Shape to be also aligned to the Top?
0
Accepted
Hello Adam,
Unfortunately, no easy way to achieve that, however, you can add images as the background of the current/selected cells and imitate the stroke. Please have a look at the attached example which is based on the CalendarCustomization example from the iOS Examples application which can be found in your local Telerik UI for Xamarin Installation. The stroke I have created is far from perfect, however, you should be able to modify the image so that it fits your requirements. You can consider setting it only for the selected cell as well.
Have a great week.
Regards,
Stefan Nenchev
Progress Telerik
Unfortunately, no easy way to achieve that, however, you can add images as the background of the current/selected cells and imitate the stroke. Please have a look at the attached example which is based on the CalendarCustomization example from the iOS Examples application which can be found in your local Telerik UI for Xamarin Installation. The stroke I have created is far from perfect, however, you should be able to modify the image so that it fits your requirements. You can consider setting it only for the selected cell as well.
Have a great week.
Regards,
Stefan Nenchev
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