question

WeiWen-3421 avatar image
0 Votes"
WeiWen-3421 asked WeiWen-3421 answered

How to make binding work for custom listview cell

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.

dotnet-xamarin
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Do you use Custom Renderers to Customizing a ViewCell ? Would you mind sharing more information about GroupAvatarItem ?


0 Votes 0 ·

1 Answer

WeiWen-3421 avatar image
0 Votes"
WeiWen-3421 answered

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.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.