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"
                  SeparatorVisibility="None"
                  ItemsSource="{Binding Items}"
                  ItemTemplate="{StaticResource RoomsDataTemplateSelector}"
                  HasUnevenRows="True">
            <ListView.Behaviors>
                <behaviors:EventHandlerBehavior EventName="ItemTapped">
                    <behaviors:InvokeCommandAction Command="{Binding ItemSelectedCommand}"/>
                </behaviors:EventHandlerBehavior>
            </ListView.Behaviors>
</ListView>

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" 
                                  Margin="16,0" 
                                  UniformColumns="2"
                                  HorizontalOptions="FillAndExpand"
                                  ItemsSource="{Binding RoomItems}"
                                  ItemTapCommand ="{Binding ItemSelectedCommand}">
        <aiforms:RepeatableWrapLayout.ItemTemplate>
            <DataTemplate>
                <cells:SquareRoomItemView/>
            </DataTemplate>
        </aiforms:RepeatableWrapLayout.ItemTemplate>
    </aiforms:RepeatableWrapLayout>

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

Answers

Sign In or Register to comment.