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

Can I get the renderer for an AbsoluteLayout?

$
0
0

I am trying to create a custom control which contains an AbsoluteLayout and the ability to scroll it in both directions.

(ScrollView would suffice, but it supports either horizontal or vertical scrolling, but not both.)

The inner AbsoluteLayout will eventually have stuff in it, but that's irrelevant for now, except to say this: I would prefer it to be an AbsoluteLayout so that the code which manages its contents can be portable. I could just implement all the inner stuff in the renderer, but I'd like to keep the platform-specific code as small as possible.

For the iOS renderer, I think I need something like this (details omitted):

    public class myRenderer : ViewRenderer<myElement, UIScrollView>
    {
        var sv = new UIScrollView();
        sv.AddSubview(Element.myInnerAbsoluteView.whatever);
        SetNativeControl(sv);
    }

But on the portable side, which Element should I subclass?

My Element wants to be a Layout, but I can't subclass that because the constructor is private.

And how do I get the inner AbsoluteLayout as a subview in the renderer? Is there something valid I can substitute for Element.myInnerAbsoluteView.whatever in the code snippet above?

I'm an XF newbie, but right now it seems to me like renderers know about their elements, but not the other way around.


Viewing all articles
Browse latest Browse all 58056

Trending Articles



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