Advice needed on how to expose platform specific extensions in common code

AttilaHAttilaH HUMember


As many of us using Xamarin Forms, I often see the need for a custom renderer, because one or the other platform specific stuff - obviously - is not available in the shared code Controls.

It would be good to have some common sense about how to expose those properties if needed. For example on IOS I need to set the Translucent property of a navigation bar. But that property is only makes sense on on iOS.

What about having an interface in each of our custom Control class with an iOS, Android and WP property which contains the given platform specific properties like (pseudo code):

Translucent : bool

OnPlatform can be an IPlatform interface, so a render can easily check for that and expose a virtual method which can handle the given platform's additional properties.

What do you think?


Sign In or Register to comment.