Bug 26402 - Renderers only work from main project??
Summary: Renderers only work from main project??
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 1.3.1
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2015-01-25 21:04 UTC by Ian
Modified: 2015-01-26 13:42 UTC (History)
3 users (show)

Is this bug a regression?: ---
Last known good build:

structure (14.77 KB, image/png)
2015-01-25 21:04 UTC, Ian

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Ian 2015-01-25 21:04:26 UTC
Created attachment 9489 [details]

(PCL, XForm 1.3.1)

Not sure if this is a bug....

We have many apps. To handle this we have a common project for IOS and a common project for Android apps. See Screenshot.

If we put a Renderer in the Common IOS project, it is ignored. If we move the renderer to the main project it works.

How do we register a renderer so that it will work from a common project that all our apps can share?

[assembly: ExportRenderer(typeof(CleanListView), typeof(CleanListViewRenderer))]

namespace Common.IOS.Renderers
   public class CleanListViewRenderer :ListViewRenderer
       protected override void OnElementChanged(ElementChangedEventArgs<ListView> e)

           var tableView = Control as UITableView;
           if (tableView != null) tableView.SeparatorStyle = UITableViewCellSeparatorStyle.None;
Comment 1 Ian 2015-01-26 13:42:55 UTC
Xamarin.Forms only looks at loaded assemblies. That means If you are putting renderers into a custom library, then that library needs to be loaded before Forms.Init is called. That means you must have used some type in the library already.


public static class CustomControls
   public static void Init() { }

Then, call the above Init method just before you call Forms.Init in your platform assemblies - make sure to do it there, the GetMainPage call is too late - everything is up by then. Calling the above method will force the custom assembly to be loaded into memory, which will then let Forms spot your attribute.