public override RecyclerView.ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType)
        {
            ViewHolder viewHolder;

            switch (viewType)
            {
            case ViewTypeHeader:
                viewHolder = new HeaderViewHolder(
                    LayoutInflater.FromContext(_context).Inflate(Resource.Layout.HeaderCell, parent, false),
                    _boxedView);
                break;

            case ViewTypeFooter:
                viewHolder = new FooterViewHolder(
                    LayoutInflater.FromContext(_context).Inflate(Resource.Layout.FooterCell, parent, false),
                    _boxedView);
                break;

            default:
                viewHolder = new ContentViewHolder(
                    LayoutInflater.FromContext(_context).Inflate(Resource.Layout.ContentCell, parent, false));
                viewHolder.ItemView.SetOnClickListener(this);
                break;
            }
            _viewHolders.Add(viewHolder);
            return(viewHolder);
        }
        private void BindContentView(ContentViewHolder holder, Cell formsCell, int position)
        {
            AView nativeCell = null;
            AView layout     = holder.ItemView;

            holder.SectionIndex = CellCaches[position].SectionIndex;
            holder.RowIndex     = CellCaches[position].RowIndex;

            nativeCell = holder.Body.GetChildAt(0);
            if (nativeCell != null)
            {
                holder.Body.RemoveViewAt(0);
            }

            nativeCell = CellFactory.GetCell(formsCell, nativeCell, _recyclerView, _context, _boxedView);

            if (position == _selectedIndex)
            {
                DeselectRow();
                nativeCell.Selected = true;
                _preSelectedCell    = nativeCell;
            }

            var minHeight = (int)Math.Max(_context.ToPixels(_boxedView.RowHeight), MinRowHeight);

            // It is necessary to set both
            layout.SetMinimumHeight(minHeight);
            nativeCell.SetMinimumHeight(minHeight);

            if (!_boxedView.HasUnevenRows)
            {
                // If not Uneven, set the larger one of RowHeight and MinRowHeight.
                layout.LayoutParameters.Height = minHeight;
            }
            else if (formsCell.Height > -1)
            {
                // If the cell itself was specified height, set it.
                layout.SetMinimumHeight((int)_context.ToPixels(formsCell.Height));
                layout.LayoutParameters.Height = (int)_context.ToPixels(formsCell.Height);
            }
            else if (formsCell is ViewCell viewCell)
            {
                // If used a viewcell, calculate the size and layout it.
                var size = viewCell.View.Measure(_boxedView.Width, double.PositiveInfinity);
                viewCell.View.Layout(new Rectangle(0, 0, size.Request.Width, size.Request.Height));
                layout.LayoutParameters.Height = (int)_context.ToPixels(size.Request.Height);
            }
            else
            {
                layout.LayoutParameters.Height = -2; // wrap_content
            }

            if (!CellCaches[position].IsLastCell || _boxedView.ShowSectionTopBottomBorder)
            {
                holder.Border.SetBackgroundColor(_boxedView.SeparatorColor.ToAndroid());
            }
            else
            {
                holder.Border.SetBackgroundColor(Android.Graphics.Color.Transparent);
            }

            holder.Body.AddView(nativeCell, 0);
        }