Search code examples
c#xamlxamarinxamarin.formshybrid

Xamarin Forms ListView with Image | Text | Time


I am currently working with xamarin forms to build a hybrid app. I am trying to build a listview that displays an error with an icon and a timestamp.

This is the concept design I want to remake into xamarin forms. I used an ImageCell to try and get the icon with some text working but now that I want to add a third element (the time) above the icon (or next to the text, the PO is not sure about that)

enter image description here


Solution

  • As @Jason said, you should use a ViewCell.

    It would be like this:

    <ViewCell>
        <StackLayout Orientation="Horizontal">
            <StackLayout>
                <Label HorizontalOptions="Center"
                       HorizontalTextAlignment="Center"/>
                <Image >
            </StackLayout>
            <Label VerticalOptions="FillAndExpand"
                   VerticalTextAlignment="Center"
                   HorizontalOptions="FillAndExpand"/>
        </StackLayout>
    </ViewCell>
    

    Add the other properties you need and your bindings and the cell is ready to use.