Hi, i am trying to build a on gridview the Xamarin.Forms.Labs project, we have a simple one working for IOS and Android, and templating is working for IOS, but now i can't use the same aproach to Android, wanted to ask for some help from the team pointing me in the right direction::
getting the datatemplate for Android is done like this:
var item = this.Element.ItemsSource.Cast<object>().ElementAt(position);
var viewCellBinded = (Element.ItemTemplate.CreateContent () as ViewCell);
viewCellBinded.BindingContext = item;
var view = RendererFactory.GetRenderer (viewCellBinded.View);
// Platform.SetRenderer (viewCellBinded.View, view);
view.ViewGroup.LayoutParameters = new Android.Widget.GridView.LayoutParams (Convert.ToInt32(this.Element.ItemWidth), Convert.ToInt32(this.Element.ItemHeight));
view.ViewGroup.SetBackgroundColor (global::Android.Graphics.Color.Blue);
return view.ViewGroup;
It renderens de the view with a Blue color and the right size, but no content is being renderer for the stuff inside the ViewGroup, what am i missing, in IOS is working in a similar way, and it work (at least for simple templates).
the code for the renderer is here:
https://github.com/XForms/Xamarin-Forms-Labs/blob/master/src/Xamarin.Forms.Labs/Xamarin.Forms.Labs.Droid/Controls/GridView/GridViewRenderer.cs
Any feedback or help will be great apreciated, all the code is in Xamarin.Forms.Labs so please give us a hand
Thanks