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

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

$
0
0

Hi!

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):

TableViewEx
OnPlatform
iOS
Translucent : bool
Android
....
WP
.....

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?

Thanks,
Attila


Viewing all articles
Browse latest Browse all 58056

Trending Articles