Multiselect in ListView problem

GyllionGyllion NLMember ✭✭

Hello everyone,

I have a layout problem. I want to something that looks similar to the output of a multi selectbox.

Normally I would say to solve this with code behind. The problem is that I must embed these 'multiselect labels' in a ListView.

My second attempt was to use a StackLayout and to bind the 'Children' property to a property in the ViewModel. I came to notice that the Children property is not bindable.

My last attempt was to the FlowListView plugin. This works, but not optimal (I can't tap on the area where the FormListView is...).

Does someone know a more suitable solution for this problem?

Best Answer

  • GyllionGyllion NLMember ✭✭
    Accepted Answer

    @AlessandroCaliaro Thanks for answering!

    I have found actually a way cleaner way to solve this problem: I've created a custom view with a StackLayout in it and I've created a custom bindable property in it which is going to contain the children of the StackLayout. With this, I'm able to use code behind to dynamically build the StackLayout.

Answers

  • AlessandroCaliaroAlessandroCaliaro ITMember ✭✭✭✭✭

    I think you can have a "Model" for your ListView that has a boolean "IsChecked" property. Bind this property to a "Switch" control. Otherwise when the Item is Selected set this property to true or false.

  • GyllionGyllion NLMember ✭✭
    Accepted Answer

    @AlessandroCaliaro Thanks for answering!

    I have found actually a way cleaner way to solve this problem: I've created a custom view with a StackLayout in it and I've created a custom bindable property in it which is going to contain the children of the StackLayout. With this, I'm able to use code behind to dynamically build the StackLayout.

  • FredyWengerFredyWenger CHInsider ✭✭✭✭✭
Sign In or Register to comment.