Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

Custom control renderer inside a shared project (Visual Studio)

$
0
0

The Custom Renderer Tutorial is very handy, but according to it you should create a renderer inside the iOS and Android project itself. I was wondering if it is possible to keep the renderer code together in a Shared Project.

I understand that shared project should not contain any platform specific code, but maybe there is a way to define certain code regions that would be only for iOS or Android.

For example in visual studio you can create a #if DEBUG / #endif region that would render only in if you project is being built in debug mode. Maybe there is some notation that would help the compiler differentiate the targets. In this case I would have both renderer classes in the same file and keep the drawing logic in one place.


Viewing all articles
Browse latest Browse all 58056

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>