I am trying to render a custom view from from xamarin.forms. When I try to render it from with following code
[assembly: ExportRenderer(typeof(SwipeableCard),typeof(CardContainer))] .
But an error throws like
default constructor not found of type 'Com.andtinde.CardContainer' .
I guess it is because the card container does not have a default constructor. And I cannot provide one because it inherits from Adapterview.
What I am doing wrong. Any help would be appriciated.
Xamarin Forms PCL: System.MissingMethodException: Default constructor not found for type
This will occur normally whenever you used a class for dependency injection or using device-specific classes. You can try it out by debugging. I had faced the same but solved it by giving the current class for typeof
property. should not give the service or any other interface name:
[assembly: Xamarin.Forms.Dependency(typeof(Name Of Class))]
and not:
[assembly: Xamarin.Forms.Dependency(typeof(Name Of Interface))]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With