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

Need help with renderers in my GridView Xamarin Forms Custom Control (maybe from forms developers)

$
0
0

Hi, all. As we know there is no GridView like Xamarin Forms Control. So i've decided to create myself this thing.
I've created a working GridView control on Android, except for a issue: the cell render does not render child controls. to be more precise, i'm able to render the first control that i place into a cell and this is sized it to fill the entire cell area, but if i place, for example a StackLayout with vertical & horizontal options set to fill and internally two buttons, the latters does not render at all, but the StackLayout does render correctly.

My code, in the GetView's Adapter method does create a linearlayout native control, then set it's dimensions to the cell width and height then perform an AddView on this passing in the view returned from RendererFactory.GetRenderer (mycell.view). the mycell.view is set to a STackLayout with two children buttons without any others layout options

I expect to see the StackLayout (that is rendered) with the two child buttons (not displayed!).

To be sure that i've not made some mistakes i've replaced the view returned from RendererFactory.GetRenderer invocation with some native calls to android apis, basically doing by hand the same layout above.
- i create a linearlayout,
- i add the two buttons widgets. It does display as expected...

So my question is: is RendererFactory.GetRender (mycell.view) the way to go? What i need to invoke to have as an android ViewGroup + childs from the xamarin view element?


Viewing all articles
Browse latest Browse all 58056

Trending Articles



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