Is it possible to use templates with renderers?

JohnHardmanJohnHardman GBUniversity mod
edited September 2017 in Xamarin.Forms

I've been doing a major re-factor today. As part of that, some classes became templated. So what was MyClass became MyClass<T> . Astonishingly, after 90 files modified by hand, everything still worked, other than one teeny weeny thing.

As the templating spread through the code, it ended up affecting one class for which I have a custom renderer.

The following is the start of the renderer for TemplatedClass, where TemplatedClass really wants to be TemplatedClass<T>

[assembly: ExportRenderer(typeof(TemplatedClass), typeof(RelatedRenderer))]
namespace AppAndroid
{
    public class RelatedRenderer : SomeVIewRenderer, IDisposable

Given that snippet of code, is it possible to change the assembly line and the class line, so that the templated class uses <T> and the related renderer also uses <T> ?

Best Answer

Answers

Sign In or Register to comment.