// Create a new photo CardView (invoked by the layout manager): public override RecyclerView.ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType) { // Inflate the CardView for the photo: View itemView = LayoutInflater.From(parent.Context). Inflate(Resource.Layout.NoteCardView, parent, false); // Create a ViewHolder to find and hold these view references, and // register OnClick with the view holder: NoteViewHolder vh = new NoteViewHolder(itemView, OnClick); return(vh); }
// Fill in the contents of the photo card (invoked by the layout manager): public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position) { NoteViewHolder vh = holder as NoteViewHolder; // Set the ImageView and TextView in this ViewHolder's CardView // from this position in the photo album: //vh.Image.SetImageResource(mPhotoAlbum[position].PhotoID); if (AllnoteModels[position].NoteContent.Length > 200) { var truncText = AllnoteModels[position].NoteContent.Substring(0, 199); var Alllines = truncText.Split('\n'); if (Alllines.Length > 6) { vh.NoteText.Text = new StringBuilder().AppendJoin('\n', Alllines[0..5]).ToString();