This is a migrated thread and some comments may be shown as answers.

Selected date Stroke Alligment

3 Answers 36 Views
Calendar & Scheduling
This is a migrated thread and some comments may be shown as answers.
Adam
Top achievements
Rank 1
Adam asked on 12 Aug 2017, 06:31 AM
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

Sort by
0
Stefan Nenchev
Telerik team
answered on 16 Aug 2017, 12:54 PM
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:

 
 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
Stefan Nenchev
Telerik team
answered on 21 Aug 2017, 12:21 PM
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
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
Tags
Calendar & Scheduling
Asked by
Adam
Top achievements
Rank 1
Answers by
Stefan Nenchev
Telerik team
Adam
Top achievements
Rank 1
Share this question
or