Forum Xamarin.Forms

CustomRenderer with subviews (children/content/etc.)

I'm currently attempting to use a CustomRendered Frame to get rounded (not round) frames in which I can embed other visual elements (and image and label). However, after following the excellent Xamarin tutorial video of RoundedBoxView and adapting for Frame, there doesn't seem to be a way to get embedded views to show up. And yet, with tapgesturerecognizers on the embedded views, though the image cannot be seen, the gesture recognizer still triggers a tap. I have only tried this on Android so far, and other than the absence of the embedded image, everything seems to be working. Does anyone have any clue what is going on here?

Answers

  • JimBennettJimBennett GBXamarin Team, Insider, University, Developer Group Leader ✭✭✭✭

    I'm having similar issues - I can only get a child that is a View to show, not a layout. Is your code open source - would be nice to have a look at it to see what you are doing compared to me.

  • ShaneSiebkenShaneSiebken USMember

    Not fully open source, but I'm happy to share my custom renderer and associated control class! I actually solved the problem today just poking around. Not sure it's the "correct" solution, but it seems to work and I wouldn't be awfully surprised if it is similar to the workings of the "stock" renderers.

  • ShaneSiebkenShaneSiebken USMember

    Also, disregard the obscene amount of Debug.WriteLine comands. They aid in my poking it turns out!

  • ShaneSiebkenShaneSiebken USMember

    I also haven't had much of a chance yet to comment, as I am working under quite a tight deadline.

  • ShaneSiebkenShaneSiebken USMember

    @SaraSilva would the folks at XLabs be interested in this? I'd be happy to share it but I don't know the best way to go about that.

Sign In or Register to comment.