Skip to content

Instantly share code, notes, and snippets.

Last active January 24, 2022 09:35
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Customized fluent binding with adapter, view holder for MvxRecyclerView
public class PersonItemAdapter : MvxRecyclerAdapter
public PersonItemAdapter(IMvxAndroidBindingContext bindingContext)
: base(bindingContext)
public override RecyclerView.ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType)
var itemBindingContext = new MvxAndroidBindingContext(parent.Context, BindingContext.LayoutInflaterHolder);
var view = InflateViewForHolder(parent, viewType, itemBindingContext);
return new PersonItemViewHolder(view, itemBindingContext);
private class PersonItemViewHolder : MvxRecyclerViewHolder
public PersonItemViewHolder(View itemView, IMvxAndroidBindingContext context)
: base(itemView, context)
_nameTextView = itemView.FindViewById<TextView>(Resource.Id.NameTextView);
this.DelayBind(() =>
var set = this.CreateBindingSet<PersonItemViewHolder, Person>();
set.Bind(_nameTextView).For(v => v.Text).To(vm => vm.Name).OneWay();
private TextView _nameTextView;
//Usage in UI Controller:
//_personRecyclerview.Adapter = new AddOnsGroupItemAdapter((IMvxAndroidBindingContext) BindingContext);
//set.Bind(_personRecyclerview).For(v => v.ItemsSource).To(vm => vm.AddOnsGroups).OneWay();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment