Forum Xamarin.Forms

How to get ItemTapCommand of RepeatableWrapLayout in ViewModel

Hi folks,

like I wrote in the title, I have a problem with RepeatableWrapLayouts (muak/AiForms.Layouts on Github) ItemTapCommand.

I have a ListView with a DataTemplate. The DataTemplate shows Items of the same type in a different way.
One way is to order the items in the ListView directly. These items are selectable without problems. The ListView looks like this:

<ListView SelectionMode="None"
                  ItemsSource="{Binding Items}"
                  ItemTemplate="{StaticResource RoomsDataTemplateSelector}"
                <behaviors:EventHandlerBehavior EventName="ItemTapped">
                    <behaviors:InvokeCommandAction Command="{Binding ItemSelectedCommand}"/>

In my ListView I have Items that are ordered horizontally inside a repeatableWrapLayout. You can see this in the following snippet:

    <aiforms:RepeatableWrapLayout Spacing="16" 
                                  ItemsSource="{Binding RoomItems}"
                                  ItemTapCommand ="{Binding ItemSelectedCommand}">

The items are shown in the correct way, but when I select items from the WrapLayout nothing happens. The ItemSelectedCommand in the ViewModel of my MainPage is not invoked.

My Question is how can I set the Command of the WrapLayouts ItemTapCommand to have the same impact like the 'normal' ItemSelectedCommand ?
Any help is appreciated. Thanks.

Best Answer


Sign In or Register to comment.