Xamarin Android binding to ExpandableListView items

Oct 13, 2015 at 6:36 PM
Hi,

I would like to bind models that contains a bool to a Checkbox in an ExpandableListView items.
I try this without success (it crashes the app):
public override View GetChildView(int groupPosition, int childPosition, bool isLastChild, View convertView, ViewGroup parent)
        {
            View row = convertView;
            if (row == null)
            {
                row = Context.LayoutInflater.Inflate(Resource.Layout.ContractTemplate, null);
            }
            
            var checkBox = row.FindViewById<CheckBox>(Resource.Id.ContractCheckBox);
            checkBox.SetBinding(
                 () => _models[groupPosition].Contracts[childPosition].Downloaded,
                 () => checkBox.Checked);

            return row;
        }
Thanks a lot for your help!
Marc
Coordinator
Oct 17, 2015 at 1:44 PM
That cannot work.

Use the GetAdapter extension method instead.

Laurent
Oct 18, 2015 at 2:30 PM
Thanks Laurent,

How do you use the GetAdapter instead to resolve such thing ?

Thanks !
Marc