public override RecyclerView.ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType) { var gridViewCell = Element.ItemTemplate.CreateContent() as FastGridCell; var initialCellSize = new Xamarin.Forms.Size(Element.ItemWidth, Element.ItemHeight); var view = new GridViewCellContainer(parent.Context, gridViewCell, parent, initialCellSize); view.Click += mMainView_Click; var width = Convert.ToInt32(Element.ItemWidth); //TODO the height is just not working out correctly for us - views end up being too small var height = Convert.ToInt32(Element.ItemHeight + _gridView.RowSpacing); var dpW = ConvertDpToPixels(width); var dpH = ConvertDpToPixels(height); view.SetMinimumWidth(dpW); view.SetMinimumHeight(dpH); view.LayoutParameters = new GridLayoutManager.LayoutParams(dpW, dpH); GridViewCell myView = new GridViewCell(view); return(myView); }
public override RecyclerView.ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType) { var gridViewCell = Element.ItemTemplate.CreateContent () as FastGridCell; var initialCellSize = new Xamarin.Forms.Size (Element.ItemWidth, Element.ItemHeight); var view = new GridViewCellContainer (parent.Context, gridViewCell, parent, initialCellSize); view.Click += mMainView_Click; var width = Convert.ToInt32 (Element.ItemWidth); //TODO the height is just not working out correctly for us - views end up being too small var height = Convert.ToInt32 (Element.ItemHeight + _gridView.RowSpacing); var dpW = ConvertDpToPixels (width); var dpH = ConvertDpToPixels (height); view.SetMinimumWidth (dpW); view.SetMinimumHeight (dpH); view.LayoutParameters = new GridLayoutManager.LayoutParams (dpW, dpH); GridViewCell myView = new GridViewCell (view); return myView; }