I'm using <telerikInput:RadCalendar> with All Day option, in which I am able to set the background color dynamically for all appointments within the time slots, but I cannot able to set the background color dynamically for All Day slot alone.
Yana
Telerik team
commented on 12 Aug 2021, 08:46 AM
I would need more details on exact scenario you have at hand - which view you're using, whether you'd need to have different colors for separate appointments? I am asking as indeed, Appointment class provides Color property which sets its bakground color. However, in DayView and MultiDayView there is a separate all-day area, where you can apply another background color to the appointments there through AllDayAppointmentBackgroundColor property - for more details on this check DayVew Styling and MultiDayView Styling topics.
We have used ViewMode="Day". Please find the attachment, i have two all day appointments where i need to set background color as green for Appointment 1 and red color for Appointment 2. I have used DayViewStyle also, but even when i have multiple appointments i can able to apply background color for only one appointment . I have mentioned the code below, looking forward for your reply. Thanks in Advance.
Code Snippet:
public DayViewStyle allDayStyle(DayViewStyle dayCell) { var a = new DayViewStyle { AllDayAppointmentBackgroundColor = Color.YellowGreen, AllDayAreaBackgroundColor = Color.Yellow, TimelineBackgroundColor = Color.Brown, }; return a; }
Thanks,
Remalin Samuel
1 Answer, 1 is accepted
0
Yana
Telerik team
answered on 17 Aug 2021, 02:32 PM
Hello Remalin,
Thanks for the additional details.
You do not need the DayView Style in the concrete case as it sets the same background color to all the appointments inside all-day area. The Appointment class has a Color property that is applied even for the all-day appointments ( in case it is not overridden by dayview style).
Here is a quick example:
new Appointment {
Title = "Appointment 1",
StartDate = date.AddHours(1),
EndDate = date.AddHours(2),
Color = Color.Green,
IsAllDay = true
},
new Appointment {
Title = "Appointment 2",
StartDate = date.AddHours(1),
EndDate = date.AddHours(2),
Color = Color.Yellow,
IsAllDay = true
},
look like this on iOS:
Please keep in mind that we previously had an issue on iOS regarding the appointments color, still it was resolved with R1 2021 release. If you do not have the same result as in the image above, check the Telerik UI for Xamarin version.
Let me know if I can assist with anything else.
Regards,
Yana
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.
I would need more details on exact scenario you have at hand - which view you're using, whether you'd need to have different colors for separate appointments? I am asking as indeed, Appointment class provides Color property which sets its bakground color. However, in DayView and MultiDayView there is a separate all-day area, where you can apply another background color to the appointments there through AllDayAppointmentBackgroundColor property - for more details on this check DayVew Styling and MultiDayView Styling topics.
I look forward to your reply.
Yana,
Thanks for the reply.
We have used ViewMode="Day". Please find the attachment, i have two all day appointments where i need to set background color as green for Appointment 1 and red color for Appointment 2. I have used DayViewStyle also, but even when i have multiple appointments i can able to apply background color for only one appointment . I have mentioned the code below, looking forward for your reply. Thanks in Advance.
Code Snippet:
public DayViewStyle allDayStyle(DayViewStyle dayCell)
{
var a = new DayViewStyle
{
AllDayAppointmentBackgroundColor = Color.YellowGreen,
AllDayAreaBackgroundColor = Color.Yellow,
TimelineBackgroundColor = Color.Brown,
};
return a;
}
Thanks,
Remalin Samuel