public override RecyclerView.ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType) { var itemView = LayoutInflater.From(parent.Context).Inflate(Resource.Layout.student_cart, parent, false); var viewHolder = new StudentViewHolder(itemView, this.OnItemClick); return(viewHolder); }
public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position) { StudentViewHolder vh = holder as StudentViewHolder; vh.Info.Text = string.Format( CultureInfo.InvariantCulture, vh.ItemView.Context.GetString(Resource.String.student_info_pattern), this.students[position].Name, this.students[position].Birthdate.ToString("dd.MM.yyyy", CultureInfo.InvariantCulture), this.students[position].University, this.students[position].GroupName); vh.PhoneImage.Visibility = this.students[position].Phone == null ? ViewStates.Invisible : ViewStates.Visible; if (this.students[position].ProfilePhoto != null) { var profilePhoto = BitmapFactory.DecodeFile(this.students[position].ProfilePhoto.AbsolutePath); vh.ProfilePhotoImage.SetImageBitmap(profilePhoto); } else { vh.ProfilePhotoImage.SetImageResource(Resource.Drawable.person_photo); } }