Пример #1
0
        protected RecyclerView.ViewHolder CreateHeaderFooterViewHolder(object content, DataTemplate template, Context context)
        {
            if (template != null)
            {
                var footerContentView = new ItemContentView(context);
                return(new TemplatedItemViewHolder(footerContentView, template, isSelectionEnabled: false));
            }

            if (content is View formsView)
            {
                return(SimpleViewHolder.FromFormsView(formsView, context));
            }

            // No template, Footer is not a Forms View, so just display Footer.ToString
            return(SimpleViewHolder.FromText(content?.ToString(), context, fill: false));
        }
Пример #2
0
        protected RecyclerView.ViewHolder CreateHeaderFooterViewHolder(object content, DataTemplate template, Context context)
        {
            if (template != null)
            {
                var footerContentView = new ItemContentView(context);
                return(new TemplatedItemViewHolder(footerContentView, template, isSelectionEnabled: false));
            }

            if (content is View formsView)
            {
                var viewHolder = SimpleViewHolder.FromFormsView(formsView, context);

                // Propagate the binding context, visual, etc. from the ItemsView to the header/footer
                ItemsView.AddLogicalChild(viewHolder.View);

                return(viewHolder);
            }

            // No template, Footer is not a Forms View, so just display Footer.ToString
            return(SimpleViewHolder.FromText(content?.ToString(), context, fill: false));
        }