public override RecyclerView.ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType) { View itemView = LayoutInflater.From(parent.Context).Inflate(Resource.Layout.recyclerview_invoice, parent, false); //InvoiceRecyclerViewViewHolder invoiceViewHolder = new InvoiceRecyclerViewViewHolder(itemView); // No clicks InvoiceRecyclerViewViewHolder invoiceViewHolder = new InvoiceRecyclerViewViewHolder(itemView, OnClick); // With clicks return(invoiceViewHolder); }
public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position) { InvoiceRecyclerViewViewHolder invoiceViewHolder = holder as InvoiceRecyclerViewViewHolder; var currentInvoice = _invoices.OrderBy(x => x.ReferenceNumber).ElementAt(position); invoiceViewHolder.ReferenceNumber.Text = "Invoice #" + currentInvoice.ReferenceNumber; invoiceViewHolder.BillTo.Text = currentInvoice.BillTo.ToString(); invoiceViewHolder.InvoiceAmount.Text = "RM " + currentInvoice.Amount.ToString(); invoiceViewHolder.InvoiceId = currentInvoice.Id; }