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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

SfSchedule - Errors while trying to customize theme

Thread ID:

Created:

Updated:

Platform:

Replies:

142091 Jan 18,2019 11:27 AM UTC Jan 22,2019 10:31 AM UTC Xamarin.Forms 3
loading
Tags: SfSchedule
Subburaj Pandian Veluchamy [Syncfusion]
Asked On January 21, 2019 09:39 AM UTC

Hi Curtis, 
  
Thanks for contacting Syncfusion support. 
  
We have analyzed the reported issue “TargetInvocationException occurs when trying to customize the default theme” and it is working fine from our side. we have ensured with customizing the default theme in simple sample and we have ensured the same with the attached sample on the UG documentation. We suspect that you didn’t set the Xamarin.Forms version as 3.0 or above as we haven mentioned in our UG documentation. Kindly check the Xamarin.Forms version. We have prepared sample for the same, please find the sample by the following link. 
  
Sample link: ScheduleTheming 
 
If the issue remains same even after updating to the Xamarin.Forms version as mentioned, kindly revert us by modifying the provided sample based on your scenario. It will be helpful for us to look on it and provide you appropriate solution. 
 
Regards,
Subburaj Pandian V 


Curtis Herrick
Replied On January 21, 2019 09:43 AM UTC

I am trying to apply a custom theme to the SfSchedule Xamarin Forms control and am having issues trying to do so.

I am getting this exception upon loading my page:

        System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.


I updated my controls to 16.4.0.47 from 16.2.0.*, which (I believe) is necessary to have access to custom theme/style control.

My page with the SfSchedule control works fine, but only if I do not try to include any custom resource theme dictionary markup, etc in the XAML.

 If I comment this theme-related markup out, the page works fine in my app, but has default theming:

<syncTheme:SyncfusionThemeDictionary>
            <syncTheme:SyncfusionThemeDictionary.MergedDictionaries>
                <syncTheme:LightTheme x:Name="LightTheme" />
                <syncfusion:SfScheduleStyles />    <-------   This line in particular is the one that causes the reflection exception noted above.
                <ResourceDictionary>
                    <Color x:Key="SfScheduleMonthCellBackgroundColor">RedColor>
                ResourceDictionary>
            syncTheme:SyncfusionThemeDictionary.MergedDictionaries>
syncTheme:SyncfusionThemeDictionary>


If I try to use the resource content above, the page loads with a non-informative reflection exception.  I've tried picking apart the resource to see if any one part of it is causing the issue.  So far, only commenting the whole block out seems to get the page to not crash.

I do have a custom BaseView that all my pages inherit from, but I don't believe that is the problem.


The page is structured as follows:
             xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="com.XXX.MyApp.PhoneViews.CalendarPage"
             xmlns:local="clr-namespace:com.XXX.MyApp"
             xmlns:schedule="clr-namespace:Syncfusion.SfSchedule.XForms;assembly=Syncfusion.SfSchedule.XForms"
             xmlns:templates ="clr-namespace:com.XXX.MyApp.Views.PhoneTemplates"
             xmlns:c="clr-namespace:com.XXX.MyApp.Views.Common"
             xmlns:material="clr-namespace:com.XXX.MaterialForms;assembly=com.XXX.MaterialForms.Standard"
             Title="{Binding Title}"
             BackgroundImage="background.png"
             xmlns:syncfusion="clr-namespace:Syncfusion.SfSchedule.XForms;assembly=Syncfusion.SfSchedule.XForms"
             xmlns:syncTheme="clr-namespace:Syncfusion.XForms.Themes;assembly=Syncfusion.Core.XForms">

Not sure why, but upon editing this post, I can no longer copy/paste the complete XAML markup here.

What do I need to do or change to get this to work?

I'm trying to follow the example as shown here:
    https://help.syncfusion.com/xamarin/sfschedule/schedule-theme


One additional bit of info gathered:

01-18 13:41:03.385 E/AppCenterCrashes( 4994): System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.TypeLoadException: Could not resolve type with token 01000103 (from typeref, class/assembly Syncfusion.SfSchedule.XForms.SfScheduleStyles, Syncfusion.SfSchedule.XForms, Version=16.4451.0.47, Culture=neutral, PublicKeyToken=null)


01-18 13:41:03.385 E/AppCenterCrashes( 4994): at com.XXX.MyApp.PhoneViews.CalendarPage..ctor () [0x00008] in C:\srclib\XXX\Mobile\Applications\MyApp\MyApp\MyApp\PhoneViews\Appointments\CalendarPage.xaml.cs:21



***  UPDATE  ***

After researching similar errors that others have experienced, I came to suspect that I had a difference in Nuget dependency versions within my Xamarin Forms solution.  To confirm this in Visual Studio, I right-clicked on the Solution in the solution explorer (not any of the child projects), and clicked "Manage Nuget Packages for Solution".  This lets you look through the various Nuget packages used within the solution - across its included projects.

Here I was able to see that some packages were not evenly updated across the solution's projects.  To fix this, you just simply need to pick the ones that are not consistent and update them for each project that is not inline with the others.

Makes sense, when the Xamarin Forms solution compiles and is running with a different version of a dependency, it may not map correctly at runtime, which gives the error "Could not resolve type with token 01000103" for example.

I've got it working now.  This thread can likely be closed.

--------------------------------------------

Note - I am not able to reply or reply with quote to your solution/response.  I am unable to get the checkbox for "I am not a robot" to respond or become checked.  You might want to check this over. - Curtis


Curtis Herrick
Replied On January 21, 2019 09:56 AM UTC

Hi Curtis, 
  
Thanks for contacting Syncfusion support. 
  
We have analyzed the reported issue “TargetInvocationException occurs when trying to customize the default theme” and it is working fine from our side. we have ensured with customizing the default theme in simple sample and we have ensured the same with the attached sample on the UG documentation. We suspect that you didn’t set the Xamarin.Forms version as 3.0 or above as we haven mentioned in our UG documentation. Kindly check the Xamarin.Forms version. We have prepared sample for the same, please find the sample by the following link. 
  
Sample link: ScheduleTheming 
 
If the issue remains same even after updating to the Xamarin.Forms version as mentioned, kindly revert us by modifying the provided sample based on your scenario. It will be helpful for us to look on it and provide you appropriate solution. 
 
Regards,
Subburaj Pandian V 


After researching similar errors that others have experienced, I came to suspect that I had a difference in Nuget dependency versions within my Xamarin Forms solution.  To confirm this in Visual Studio, I right-clicked on the Solution in the solution explorer (not any of the child projects), and clicked "Manage Nuget Packages for Solution".  This lets you look through the various Nuget packages used within the solution - across its included projects.

Here I was able to see that some packages were not evenly updated across the solution's projects.  To fix this, you just simply need to pick the ones that are not consistent and update them for each project that is not inline with the others.

Makes sense, when the Xamarin Forms solution compiles and is running with a different version of a dependency, the interpretted type may not map correctly at runtime, which gives the error "Could not resolve type with token 01000103" for example.

I've got it working now.  This thread can likely be closed.

--------------------------------------------

Note - It was difficult to reply or reply with quote to your solution/response.  After some experimentation, I found that I had to rapidly/repeatedly click the "I am not a robot" checkbox (like 20 times) to get it to respond or become checked.  You might want to look into this. 

Thanks! 
- Curtis


Subburaj Pandian Veluchamy [Syncfusion]
Replied On January 22, 2019 10:31 AM UTC

Hi Curtis, 
 
Thank you for the update. We are happy that the given solution meets your requirement. 
 
Regarding Website related query: 
 
Sorry for the inconvenience caused.  
 
We have checked and we are unable to reproduce the issue you have reported “I am not a robot” not responding. Can you please share following details to replicate the issue? 
  
·       Browser details. 
·       Browser console error details. 
 
It will more helpful for us to check on it and resolve the reported issue as early as possible. 
 
Regards,
Subburaj Pandian V  
 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;