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

AppointmentStyle has no effect

1 Answer 97 Views
Calendar & Scheduling
This is a migrated thread and some comments may be shown as answers.
Mike
Top achievements
Rank 1
Mike asked on 06 Jun 2018, 04:40 PM

I am trying to set the styling on the calendar.    However,it does not matter what settings I choose.  In Android I always get a "+1" in the Date that has an appointment.  I created my RadCalendar in XAML.  However, I was unable to find an example on how to set AppointmentStyle properties there.  So I gave the XAML element a x:Name and did so on the C# side.  Also, found info saying there was a bug if you tried to set the styling before the native control loaded so I added the code there.  Using the example I found in the documentation below has no effect. The calendar is set to month view.

MyCalendar.AppointmentsStyle = new CalendarAppointmentsStyle() {
    DisplayMode = AppointmentDisplayMode.Shape,
    Padding = new Thickness(5, 25, 5, 5),
    MaxCount = 20,
    Spacing = 1,
    ShapesHorizontalLocation = HorizontalLocation.Right,
    ShapesVerticalLocation = VerticalLocation.Bottom,
    ShapesOrientation = Orientation.Vertical,
    ShapeSize = new Size(6, 4),
    ShapeType = CalendarAppointmentShapeType.Rectangle,
    AllDayShapesDisplayMode = AllDayDisplayMode.Indicator,
    AllDayIndicatorLocation = Location.Top,
    AllDayIndicatorPadding = new Thickness(5, 2),
    AllDayIndicatorWidth = 2,
};

1 Answer, 1 is accepted

Sort by
0
Stefan Nenchev
Telerik team
answered on 07 Jun 2018, 08:30 AM
Hi, Mike,

From the explanation you have provided, it seems to me that the behavior is observed due to the size of the RadCalendar. Basically, if the size of the calendar is too small - so that there is not enough space in the date cells to render the appointments - it will render a number that shows the count of appointments for this day. Can you please share the exact layout that you are using? Would it be possible to alter the Calendar so that it has bigger size and test the behavior this way? Otherwise, please make sure that the values you set in the AppointmentsStyle would fit a smaller cell. For example:

(this.calendar as RadCalendar).AppointmentsStyle = new Telerik.XamarinForms.Input.CalendarAppointmentsStyle()
     {
         DisplayMode = AppointmentDisplayMode.Shape,
         MaxCount = 20,
         FontSize = 2,
         Spacing = 1,
         ShapeSize = new Size(3, 3),
         ShapeType = CalendarAppointmentShapeType.Rectangle,
         ShapesVerticalLocation = VerticalLocation.Center,
         ShapesOrientation = Orientation.Horizontal
     };

As for the AppointmentsStyle not being applied before the native control is loaded, we have already fixed this bug and it should not cause any issues with the 2018.2.516 version of the controls(the one which is chosen in this ticket).

I have attached a sample for your reference. Please consider which option suits you best - to change the size of the calendar or to change the AppointmentsStyle so that it is suitable for smaller cells.

Have a great rest of the 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
Mike
Top achievements
Rank 1
Answers by
Stefan Nenchev
Telerik team
Share this question
or