I am building a custom renderer for my Windows Phone project. I tried many things, but no matter what I do, the Control
property is null
when entering the OnElementChanged
callback.
Here's an example I just made where I am trying to make my own ImageRenderer.
using Xamarin.Forms;
using Xamarin.Forms.Platform.WinPhone;
[assembly: ExportRenderer(typeof(Image), typeof(Zooganizer.Apps.WinPhone.Renderers.ImageRenderer))]
namespace TestProject.Apps.WinPhone.Renderers
{
public class ImageRenderer : Xamarin.Forms.Platform.WinPhone.ImageRenderer
{
protected override void OnElementChanged(ElementChangedEventArgs<Image> e)
{
//Control is null here always, which makes it hard for me to access the native control.
base.OnElementChanged(e);
}
}
}
I tried many things but without luck (for instance, trying to change the base from an ImageRenderer into something else). What am I doing wrong?
I am running and compiling the project through Visual Studio 2015 CTP 6.