New to Telerik UI for Xamarin? Download free 30-day trial

Change Appointment Text color in Calendar Week View when app theme is changed

Environment

Product Version 2020.3.1106.1
Product Calendar for Xamarin Cross-Platform

Description

This help article will show you how to change the Calendar Appointment Text Color when the system theme is changed.

Solution

The properties of the CalendarAppointmentStyle class are not bindable, so the whole style needs to be changed when the system theme changes.

You should use the following approach:

<ContentPage.Resources>
    <ResourceDictionary>
        <Color x:Key="LightColor">Red</Color>
        <Color x:Key="DarkColor">Blue</Color>
    </ResourceDictionary>
</ContentPage.Resources>
<StackLayout>
    <telerikInput:RadCalendar x:Name="calendar" ViewMode="Week">
        <telerikInput:RadCalendar.AppointmentsStyle>
            <AppThemeBinding>
                <AppThemeBinding.Light>
                    <telerikInput:CalendarAppointmentsStyle DisplayMode="TextWithShape"
                                                            TextColor="{​​​​​​​StaticResource LightColor}​​​​​​​"/>
                </AppThemeBinding.Light>
                <AppThemeBinding.Dark>
                    <telerikInput:CalendarAppointmentsStyle DisplayMode="TextWithShape"
                                                            TextColor="{​​​​​​​StaticResource DarkColor}​​​​​​​"/>
                </AppThemeBinding.Dark>
            </AppThemeBinding>
        </telerikInput:RadCalendar.AppointmentsStyle>
    </telerikInput:RadCalendar>
</StackLayout>
In this article
Not finding the help you need? Improve this article