Articles in this section
Category / Section

How to resolve Xamarin renderer assemblies issues in TreeView?

2 mins read

Xamarin does not load the renderer assemblies, by default, in iOS and UWP projects. Hence, to solve this, you need to manually load it by calling the Init method of Xamarin TreeView in the respective projects as mentioned below.

iOS Project

Call the SfTreeViewRenderer.Init() in the FinishedLaunching overridden method of the AppDelegate class after the Xamarin.Forms Framework initialization, and before the LoadApplication is called as demonstrated in the following code example:

public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
    …
    global::Xamarin.Forms.Forms.Init();
    SfTreeViewRenderer.Init();
    LoadApplication(new App());
    …
}

 

UWP Project

Call the SfTreeViewRenderer.Init() in the MainPage constructor before the LoadApplication is called as demonstrated in the following code example:

public MainPage()
{
    …
    SfTreeViewRenderer.Init();
    LoadApplication(new App());
    …
}

 

ReleaseMode Issue in UWP Platform

The known Framework issue in UWP platform is the custom controls will not render when deployed the application in Release Mode.

The above problem can be resolved by initializing the TreeView assemblies in App.xaml.cs in UWP project as in the following code snippet:

// In App.xaml.cs
protected override void OnLaunched(LaunchActivatedEventArgs e)
{
    …
    rootFrame.NavigationFailed += OnNavigationFailed;
    // you'll need to add ‘using System.Reflection;’
    List<Assembly> assembliesToInclude = new List<Assembly>();
    //Now, add all the assemblies your app uses
    assembliesToInclude.Add(typeof(SfTreeViewRenderer).GetTypeInfo().Assembly);
    // replaces Xamarin.Forms.Forms.Init(e);        
    Xamarin.Forms.Forms.Init(e, assembliesToInclude);
    …     
}

 


Conclusion

I hope you enjoyed learning on how to resolve Xamarin renderer assemblies issues in TreeView.

You can refer to our Xamarin TreeView feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our Xamarin TreeView example to understand how to present and manipulate data.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.

If you have any queries or require clarifications, please let us know in the comments below. You can also contact us through our support forumsDirect-Trac, or feedback portal. We are always happy to assist you!

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