How to make binding work for custom listview cell

Wei Wen 1,126 Reputation points
2021-08-25T16:16:04.433+00:00

I have a custom list view cell with a custom component. Because the custom component has to be hard coded in xamal, I tried to use binding. But it does not work. Here is the line of code that is part of a list cell:
<local:GroupAvatarItem Group={binding Group} />

Because this is hard-coded in xamal, only the constructor of GroupAvatarItem without parameter is called. But I was hoping that doing "Group={binding Group}" will still pass the Group object to GroupAvatarItem. But apparently it didn't. Does this mean I have to create GroupAvatarItem in C# code and use the constructor with parameter? If so, I am not sure how to do this since the other list cell components all have values using binding in xamal.

Developer technologies | .NET | Xamarin
{count} votes

Accepted answer
  1. Wei Wen 1,126 Reputation points
    2021-09-01T13:25:16.603+00:00

    I think binding for custom component inside list view does not work. So I have to unpack subcomponents in GroupAvatarItem and put them directly inside list view cell.

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.