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

Add separator/divider between rows in a ListView

$
0
0

I know there exists a solution for IOS(using ExtendedViewCell from Xamarin forms labs), but I am looking for a way to do the same for Android.
This is how I am solving it for now, looking if someone has come up with other approach(s):

<ListView.ItemTemplate>
                <DataTemplate>
                    <ViewCell>
                        <ViewCell.View>
                            <StackLayout>
                                <StackLayout 
                                    Orientation="Horizontal"
                                    Padding="20">
                                    <Image Source="{Binding MyImageSource}"/>
                                    <StackLayout 
                                        Orientation="Vertical"
                                        HorizontalOptions="FillAndExpand">
                                        <Label Text="{Binding MyLabel1}"></Label>
                    <Label Text="{Binding MyLabel2}"></Label>
                                    </StackLayout>
                                </StackLayout>
                                <StackLayout 
                                    BackgroundColor="MySeparatorColor"
                                    HeightRequest="1"
                                    HorizontalOptions="FillAndExpand"
                                    VerticalOptions="EndAndExpand"/>
                            </StackLayout>
                        </ViewCell.View>
                    </ViewCell>
        </DataTemplate>
</ListView.ItemTemplate>

Viewing all articles
Browse latest Browse all 77050

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>