Home > Net >  How to display list of images with some images double-width
How to display list of images with some images double-width

Time:05-03

I'm trying to achieve this on my Xamarin project

enter image description here

So what I want is to display my images from my Category entity like this, some would expand horizontally and some would be displayed by two in one row.

What I have achieved so far is this.

enter image description here

Here is my code

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="AppCrijoya.Views.CategoryPage">
    <ContentPage.Content>

        <StackLayout>

            <ListView x:Name="listTemp" HasUnevenRows="True" IsPullToRefreshEnabled="False" ItemTapped="ListViewCategorias_ItemTapped" >
                <ListView.ItemTemplate>
                    <DataTemplate>
                        <ViewCell>
                            <Grid HorizontalOptions="FillAndExpand" VerticalOptions="Start" HeightRequest="270" RowSpacing="6">
                                <Image Source="{Binding Image}" Aspect="Fill" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand"></Image>
                            </Grid>
                        </ViewCell>
                    </DataTemplate>
                </ListView.ItemTemplate>
            </ListView>

        </StackLayout>
    </ContentPage.Content>

    <ContentPage.ToolbarItems>
        <ToolbarItem Text="CERRAR SESIÓN" Clicked="Logout_Clicked"/>
    </ContentPage.ToolbarItems>
    
</ContentPage>

Please help, I'm new to Xamarin and I'm still trying to understand how the views work.

CodePudding user response:

You could simply use enter image description here

  • Related