I'm using the RoundedBoxViewRenderer example from here (http://developer.xamarin.com/guides/cross-platform/xamarin-forms/custom-renderer/) and I updated it to inherit from Frame and not BoxView because I want a rounded Frame. The frame is rendering rounded.
The problem is that the custom renderer is drawn on top of the content thus the Frame's content is hidden.
So my question is: how to customise a Frame while keeping the content? Or a generic question would be: How to add Xamarin.Form Views as subviews of UIView or Android Views?
This is the Box custom renderer:
var rbv = e.NewElement;
if (rbv != null) {
var shadowView = new UIView();
childView = new UIView() {
BackgroundColor = rbv.Stroke.ToUIColor(),
Layer = {
CornerRadius = (float)rbv.CornerRadius,
BorderColor = rbv.Stroke.ToCGColor(),
BorderWidth = (float)rbv.StrokeThickness,
MasksToBounds = true
},
AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight
};
shadowView.Add(childView);
if (rbv.HasShadow) {
shadowView.Layer.ShadowColor = UIColor.Black.CGColor;
shadowView.Layer.ShadowOffset = new SizeF(3, 3);
shadowView.Layer.ShadowOpacity = 1;
shadowView.Layer.ShadowRadius = 5;
}
SetNativeControl(shadowView);
}
How can I do something like this?
shadowView.Add(rbv.Content);
// or
childView.AddSubview (rbv.Content);