Articles in this section
Category / Section

How to resolve the rendering issue with Syncfusion controls using the latest MVVMCross

1 min read

To render the Syncfusion control in release mode of the UWP, you need some additional step to add their renderer as mentioned in the following link.

 

https://help.syncfusion.com/xamarin/charts/getting-started#universal-windows-platform-uwp

 

In MVVMCross version 6.12 and above, even added those will not render the Syncfusion control. This article mainly to know how to render even with mentioned MVVMCross version with example of SfChart control.

 

The following UI with MVVMCross application in debug mode.

 

debug mode output

 

But in release mode, it will be rendered with empty screen even with adding their renderer as follows.

 

sealed partial class App
    {
        public App()
        {
            this.InitializeComponent();
        }
 
        protected override void OnLaunched(LaunchActivatedEventArgs activationArgs)
        {
            base.OnLaunched(activationArgs);
 
            List<Assembly> assembliesToInclude = new List<Assembly>();
            assembliesToInclude.Add(typeof(Syncfusion.SfChart.XForms.UWP.SfChartRenderer).GetTypeInfo().Assembly);
            Xamarin.Forms.Forms.Init(activationArgs, assembliesToInclude);
        }
    }

 

How to resolve this issue

It has been resolved by changing the MvxFormsWindowsSetup<Core.App, FormsUI.App> with MVVMCrossSetup as shown in the following code samples:

Before code changes

public abstract class UWPApplication : MvxWindowsApplication<MvxFormsWindowsSetup<Core.App, FormsUI.App>, Core.App, FormsUI.App, MainPage>
    {
 
    }

 

After code changes

 

public abstract class UWPApplication : MvxWindowsApplication<MVVMCrossSetup, Core.App, FormsUI.App, MainPage>
    {
 
    }
 
    public class MVVMCrossSetup : MvxFormsWindowsSetup<Core.App, FormsUI.App>
    {
        public override IEnumerable<Assembly> GetViewAssemblies()
        {
            var syncfusionChartRendererAssembly = new List<Assembly>()
                {
                    typeof(Syncfusion.SfChart.XForms.UWP.SfChartRenderer).GetTypeInfo().Assembly
                };
            syncfusionChartRendererAssembly.AddRange(base.GetViewAssemblies());
            return syncfusionChartRendererAssembly;
        }
    }

 

View the sample in GitHub.

Output

Release mode output

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied