public static SimpleViewHolder FromFormsView(View formsView, Context context, Func <int> width, Func <int> height) { var itemContentControl = new SizedItemContentView(context, width, height); itemContentControl.RealizeContent(formsView); return(new SimpleViewHolder(itemContentControl, formsView)); }
public override RecyclerView.ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType) { var context = parent.Context; if (EmptyViewTemplate == null) { if (!(EmptyView is View formsView)) { // No template, EmptyView is not a Forms View, so just display EmptyView.ToString return(new EmptyViewHolder(CreateTextView(EmptyView?.ToString(), context), null)); } // EmptyView is a Forms View; display that var itemContentControl = new SizedItemContentView(CreateRenderer(formsView, context), context, () => parent.Width, () => parent.Height); return(new EmptyViewHolder(itemContentControl, formsView)); } // We have a template, so create a view from it var templateElement = EmptyViewTemplate.CreateContent() as View; var templatedItemContentControl = new SizedItemContentView(CreateRenderer(templateElement, context), context, () => parent.Width, () => parent.Height); return(new EmptyViewHolder(templatedItemContentControl, templateElement)); }
public static SimpleViewHolder FromFormsView(View formsView, Context context, Func <int> width, Func <int> height, ItemsView container) { var itemContentControl = new SizedItemContentView(context, width, height); // Make sure the Visual property is available during renderer creation Internals.PropertyPropagationExtensions.PropagatePropertyChanged(null, formsView, container); itemContentControl.RealizeContent(formsView); return(new SimpleViewHolder(itemContentControl, formsView)); }
public override RecyclerView.ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType) { var context = parent.Context; var template = EmptyViewTemplate; if (template == null) { if (!(EmptyView is View formsView)) { // No template, EmptyView is not a Forms View, so just display EmptyView.ToString return(new EmptyViewHolder(CreateTextView(EmptyView?.ToString(), context), null)); } // EmptyView is a Forms View; display that var itemContentControl = new SizedItemContentView(context, () => parent.Width, () => parent.Height); itemContentControl.RealizeContent(formsView); return(new EmptyViewHolder(itemContentControl, formsView)); } var itemContentView = new SizedItemContentView(parent.Context, () => parent.Width, () => parent.Height); return(new TemplatedItemViewHolder(itemContentView, template)); }