0

So want to render out of box CarouselView when Android and CarouselViewFormsPlugin when iOS. I know can accomplish this in xaml using onplatform but don't want to have to do that in several places. Can this be done using custom Renderer like following?

Core Project:

public class CustomCarousel{}

Android:

public class CustomCarousel:CarouselView{}

iOS

public class CustomCarousel:CarouselView.Plugin{}

If this is not possible i have two options that i can see:

  1. In xaml use onplatform to determine which control to use.
  2. Have a different view for iOS and Android and determine at runtime which view to render.

I know i can implement these two options but i think that if possible CustomRenderer is best solution here?

Maxqueue
  • 2,194
  • 2
  • 23
  • 55
  • If you use custom renderer to achieve it, you must inherit the `CarouselPageRenderer`, So it is cannot be used like `public class CustomCarousel:CarouselView.Plugin{}` format. – Leon Nov 04 '20 at 08:22
  • Yes that is conclusion i came to which does not work so ended up just doing onplatform in the xaml to render respective control – Maxqueue Nov 04 '20 at 16:24
  • Ok. Just achieve it in the xaml. – Leon Nov 05 '20 at 08:25

0 Answers0