We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

MonthViewSettings properties cannot be set using DynamicResource

I'm using 

calendar.MonthViewSettings.SetDynamicResource (VisualElement.StyleProperty, "some.resource") 

to set dynamic styles on SfCalendar.MonthViewSettings. However it seems following properties cannot be set using DynamicResource and they have their default (built-in) values:

MonthViewSettings.TodayTextColorProperty
MonthViewSettings.SelectedDayTextColorProperty
MonthViewSettings.DateSelectionColorProperty

When setting these properties directly (i.e. not using Xamarin Forms styles but directly on SfCalendar instance) they are working as expected.

2 Replies

RK Rathana Kumar Sekar Syncfusion Team February 13, 2017 11:43 AM UTC

Hi Tomas,

Thanks for contacting Syncfusion Support.

Currently, we are analyzing the reported issue, "MonthViewSettings properties cannot be set using DynamicResource." We will provide further update on February 14, 2017.

Regards,
Rathanakumar S.


RK Rathana Kumar Sekar Syncfusion Team February 14, 2017 12:49 PM UTC

Hi Tomas,

We have checked the reported issue based on the provided details.On analyzing further, we found that applying Application Resource as Dynamic Resource has some limitation in Xamarin.Forms. Please find the Xamarin.Forms forum link which is related to the reported issue in below

Link: https://forums.xamarin.com/discussion/65252/dynamicresource-limitation-for-onplatform-in-xaml-xamarin-forms

We have prepared sample to show demo on "How to use StaticResource for MonthViewSettings API's."Please find the sample from below link.

Sample: http://www.syncfusion.com/downloads/support/forum/128848/ze/calendartestsample-242837818 

So we suggest you to use the following ways to apply Application Resource to customize the MonthViewSettings API's.

Solution 1: Use Application Resource as Static Resource

<MonthViewSettings TodayTextColor="{StaticResource todaytextcolor} " />


Solution 2: Access the application Resource from code behind

calendar.MonthViewSettings.TodayTextColor =(Color) Application.Current.Resources["todaytextcolor"];


Regards,
Rathanakumar S  


Loader.
Live Chat Icon For mobile
Up arrow icon