Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

How do you toggle between two views?

$
0
0

We have a ListView with two possible item layouts, how do we toggle between them? We tried using the IsVisible property, but when the 2nd StackLayout is invisible, it still allocates its height onto the ListView and gives a white space.

<ListView VerticalOptions="FillAndExpand"
                      BackgroundColor="Transparent"
                      ItemsSource="{Binding ListData}"
                      ItemTapped="ClaimHistoryListTapped">
                <ListView.ItemTemplate>
                    <DataTemplate>
                        <ViewCell>
                            <StackLayout BackgroundColor="#dddddd"
                                         Padding="10, 10, 10, 10"
                                         IsVisible="true">
                                <Label Text="En traitement"
                                       TextColor="#666666"/>
                            </StackLayout>
                            <StackLayout Padding="10, 10, 10, 10"
                                         IsVisible="{Binding IsClaimCell}">
                                <Label Text="{Binding Text}" />
                                <Label Text="{Binding Detail}" />
                                <Label Text="{Binding Montant}" />
                            </StackLayout>
                        </ViewCell>
                    </DataTemplate>
                </ListView.ItemTemplate>
            </ListView>

Anyone has an idea? Or did something similar? :(


Viewing all articles
Browse latest Browse all 58056

Trending Articles