Consume a UI Component in XF from Binding Library (Android)

LeoJHarrisLeoJHarris NZMember ✭✭✭

Hi everyone! I'm trying create and integrate my first android Binding Library to be consumed in my XF project, the native android library Im trying to consume in my Xamarin.Forms project is here: https://github.com/florent37/DiagonalLayout

I've read up on the docs for Android bindings and have already created the .aar from the native project, added that to the jars folder in the binding library project and built the project with no errors thrown.

I have also created a XF library project which references the android binding library and I have a class that extends the native component in my xamarin android project and am using the ExportRenderer to access from my forms project see below:

The problem I am having is when I run the application I get this error:

System.InvalidCastException: Specified cast is not valid.

Now I know the issue is I am trying to take the android.widget.framelayout and use as a frame in my forms project which i cant (not sure how I can though):

public class XFDiagonalView : Frame { }

How can I translate the android.widget.framelayout into something I can use in my forms project and consume in my projects? I've tried to get this to work but not having the any luck.

Id like to get this too work so I can get other native bindings to work on other projects and see it as a good learning experience :)

Am I close or not even close on this, any suggestion on how you might do this would be appreciated!!

Posts

Sign In or Register to comment.