Reputation: 3558
Is it possible to get Android.View
(and equivalent view object in iOS
) from Xamarin.Form.View
? I have custom control which takes dependencies to Android.View
. I am writing custom renderer which would set that custom control as native view but I need to convert my ContentView
(exposed as BindableProperty
, initialized in xaml) from Portable library
to Android.View
.
Upvotes: 3
Views: 4055
Reputation: 5234
Yes you can. I have written an extension that uses reflection to get the underlying native view:
Native view in the code is Android.Views.View type and View is Xamarin.Forms.View.
The same works for iOS as well, just cast it to UIView.
Upvotes: 3